NG for xHarbour

NG for xHarbour

Postby devtuxtla » Tue Sep 24, 2013 12:54 am

Hola FiveWinners

Anyone know where I can find NG for xHarbour?

Regards
Visite Chiapas, el paraiso de México.
devtuxtla
 
Posts: 392
Joined: Tue Jul 29, 2008 1:55 pm

Re: NG for xHarbour

Postby Antonio Linares » Tue Sep 24, 2013 7:28 am

Gustavo,

Puesto que Harbour y xHarbour son muy parecidos, esto puede ayudarte:

http://www.fivetechsoft.com/harbour-docs/harbour-reference-guide.htm

Tambien tienes más documentación aqui:
viewtopic.php?f=17&t=12807&start=0
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: NG for xHarbour

Postby devtuxtla » Tue Sep 24, 2013 12:38 pm

Hola Antonio

Gracias

Estoy buscando mayor informacion sobre SOAP a traves de HTTPS.

sigo buscando

Saludos
Visite Chiapas, el paraiso de México.
devtuxtla
 
Posts: 392
Joined: Tue Jul 29, 2008 1:55 pm

Re: NG for xHarbour

Postby Antonio Linares » Tue Sep 24, 2013 12:43 pm

Has buscado la palabra SOAP en estos foros ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: NG for xHarbour

Postby devtuxtla » Tue Sep 24, 2013 2:48 pm

Hola Antonio.

Si claro, pero ahora el reto es hacerlo a traves de https con certificados (.cer)

Espero resolverlo y publicarlo despues.

Saludos
Visite Chiapas, el paraiso de México.
devtuxtla
 
Posts: 392
Joined: Tue Jul 29, 2008 1:55 pm

Re: NG for xHarbour

Postby Antonio Linares » Tue Sep 24, 2013 3:00 pm

Gustavo,

Ahora yo busqué por SOAP y HTTPS y no encontré nada :-)

Parece que es la primera vez que se trata este tema en los foros.

Ojalá alguien nos pueda ayudar. Rafa ??? :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: NG for xHarbour

Postby thefull » Wed Sep 25, 2013 7:18 am

Buenos dias

Yo uso conexiones https con certificados. Lo único que tuve que hacer es instalarlo en el navegador.
Lo que pasa que puedes tener problemas sin el certificado no esta verificado por un tercero. Si está verificado , por poner un ejemplo, Verisign,
no deberías tener ningún problema, es transparente.

El proceso se complica cuando quieres usar un certificado no verificado, por ejemplo, emitido por ti mismo.
En estos casos, tienes que instalarlo en el navegador de la siguiente manera;

Image
Uploaded with ImageShack.us
Saludos
Rafa Carmona ( rafa.thefullARROBAgmail.com___quitalineas__)
User avatar
thefull
 
Posts: 729
Joined: Fri Oct 07, 2005 7:42 am
Location: Barcelona

Re: NG for xHarbour

Postby Antonio Linares » Wed Sep 25, 2013 8:28 am

Rafa,

Podrias mostrar el código de un ejemplo sencillito ? gracias :-)

Y gracias por estar siempre dispuesto a ayudar ;-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: NG for xHarbour

Postby reinaldocrespo » Sun Sep 29, 2013 2:20 am

SOAP is used to consume webservices. You are probably wanting to consume webservices from an https site. I'm currently successfully sending and receiving data on realtime consuming webservices from https. I'm using xharbour tHttpClient() class. I had to make some minor modifications to the parent class (Tclient()).

You will need to visit the .asmx site to view the xml tree that needs to be built. Here is some code that consumes a specific webservice from an https url:

Code: Select all  Expand view

//the func below will create an x12-270 hipaa message and will connect to
//the clearinghouse webservice to find the patient's eligibility for the
//medical service being rendered.

FUNCTION FindClmEligibility( cClaimKey, isSilent )
   LOCAL oImWs
   LOCAL cFileName, cRet

...
   oImWs := InmediataWs():InitRealTime( oApp():oMeter )  

   IF oImWs == NIL   ;RETURN NIL ;ENDIF
   
   oImWs:isSilent := isSilent
   oImWs:cMessage := MemoRead( cFileName )
   oImWs:SendRealTimeMessage()
   
   cRet := oImWs:cResponse
   oImWs:End()

...

//---------------------------------------------------------------------------
METHOD InitRealTime( oMeter ) CLASS InmediataWs
   LOCAL isLogHttpProgress := GetValFromRepository( "X12WebService", "LogProgress", "NO" ) $ "YES,.T., TRUE,Y"
   LOCAL nTimeOut := VAL( GetValFromRepository( "X12WebService", "TimeOut", "30000", "Timeout in milliseconds" ) )
   LOCAL cUserName:= GetValFromRepository( "X12WebService", "UserName", "Name" )
   LOCAL cPassword:= GetValFromRepository( "X12WebService", "Password", "Passwrd" )
   LOCAL cUrl := GetValFromRepository( "X12WebService", "RealTime_Eligibility_Url", ;
                  'https://www.inmediata.com/webservices/editransfer/edirealtime.asmx' )

   TRY
      ::oHttp := tIPClientHTTP():new( cUrl, isLogHttpProgress )
   CATCH
      MsgStop( "Missing SSL libs or no access to https was found.", "Check Installation" )
      RETURN NIL
   END
   
   IF ::oHttp == NIL    ;RETURN NIL    ;ENDIF

   ::oHttp:nConnTimeOut := nTimeOut
   ::cUserName := cUserName
   ::cPassword := cPassword

   ::oMeter := oMeter

   IF ::oMeter != NIL
      ::oMeter:nTotal := 100
      ::oMeter:Show()
      ::oHTTP:exGauge := { | nAt, nTotal, oSelf| ::oMeter:Set( ( Max( nAt, 0.00001 ) / Max( nTotal, 0.00001 ) ) * 100 ) }
   ENDIF

   IF ::oHttp:open()
   
      ::oHttp:hFields[ 'Content-Type'] := 'application/soap+xml; charset=utf-8'
      RETURN SELF

   ENDIF
   
RETURN NIL


//---------------------------------------------------------------------------
METHOD SendRealTimeMessage() CLASS InmediataWs
   LOCAL cPost
   
   cPost := ;
      '<?xml version="1.0" encoding="utf-8"?>'+;
      '<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">'+;
      '  <soap12:Header>'+;
      '    <AuthenticationHeader xmlns="https://www.inmediata.com/ws/EdiRealTime/">'+;
      '      <Username>' + ::cUserName + '</Username>'+;
      '      <Password>' + ::cPassword + '</Password>'+;
      '    </AuthenticationHeader>'+;
      '  </soap12:Header>'+;
      '  <soap12:Body>'+;
      '    <SendRealTime xmlns="https://www.inmediata.com/ws/EdiRealTime/">'+;
      '      <X12Data>' + ::cMessage + '</X12Data>'+;
      '    </SendRealTime>'+;
      '  </soap12:Body>'+;
      '</soap12:Envelope>'


      IF ::oHttp:Post( cPost ) ;::GetRealTimeMessage()   ;ENDIF

     
RETURN NIL

//---------------------------------------------------------------------------
METHOD GetRealTimeMessage() CLASS InmediataWs
   LOCAL oXmlDoc := TXmlDocument():New()// HBXML_STYLE_NOESCAPE )
   LOCAL cResponse
   LOCAL oXmlNode, cRet


   cResponse := ::oHttp:ReadAll()

   oXmlDoc:Read( cResponse )

   oXmlNode := oXmlDoc:FindFirst( "RealTimeResponse" )
   IF oXmlNode != NIL   ;cRet := oXmlNode:cData  ;ENDIF

   oXmlNode := NIL
   oXmlDoc  := NIL

   ::cResponse := cRet

RETURN cRet

 


You will need to download and use OpenSSL libs. Check my messages on the subject on the xharbour forum.

Hope that helps,


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 972
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: NG for xHarbour

Postby HunterEC » Sun Sep 29, 2013 5:52 am

Reinaldo:

I need to consult you on a topic, can you send me your email address ? Thank you.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: NG for xHarbour

Postby reinaldocrespo » Sun Sep 29, 2013 2:00 pm

Sure, for you as well as anyone else, you can write to me at

reinaldo dot crespo

at gmail.


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 972
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: NG for xHarbour

Postby reinaldocrespo » Mon Sep 30, 2013 2:32 pm

I was asked via private email about consuming http/https webservices. I'm thinking it is best if we share this information publicly so that everyone (sooner or later) benefits and is able to participate. Below is sample code currently under production that fetches patient eligibility for medical services from https setup by the clearinghouse.

Code: Select all  Expand view


*-------------------------------------------------------------------------------------------------------------------------------
//function getValFromRepository is a replacement for Tini class, where values can be saved as a variable name
//under a given section.  The difference is that all these values are stored into a .dbf table instead of a text file.
//
//Some unrelated code has been removed to aid in clarity.
//
FUNCTION FindPteEligibility( cRecNo, cContract, cIns, isSilent )
   LOCAL cUserName:= GetValFromRepository( “X12WebService", "UserName", "psswrd" )
   LOCAL cPassword:= GetValFromRepository( “X12WebService"
, "Password", "usrname" )
   LOCAL cUrl := GetValFromRepository( "X12WebService", "RealTime_Eligibility_Url", ;
                  'https://www.inmediata.com/webservices/editransfer/edirealtime.asmx' )
   LOCAL oImWs
   LOCAL cFileName, cRet
   LOCAL isCreated := .F.
   LOCAL o270 := t270():New()

   DEFAULT isSilent := .F.



   
   oImWs := InmediataWs():InitRealTime()  
   IF oImWs == NIL   ;RETURN NIL ;ENDIF
   
   oImWs:isSilent := isSilent
   oImWs:cMessage := MemoRead( cFileName )
   oImWs:SendRealTimeMessage()
   
   cRet := oImWs:cResponse
   oImWs:End()

   ferase( cFileName )
   
RETURN cRet


//---------------------------------------------------------------------------
CLASS InmediataWs

   DATA aFiles    AS ARRAY INIT {}
   DATA aRoutedFiles AS ARRAY INIT {}
   DATA aResponse AS ARRAY INIT {}
   DATA aRespPages  AS ARRAY INIT {}

   DATA cUserName, cPassword
   DATA cMessage, cResponse

   DATA lShowProgress  INIT .F.
   DATA lShowConnected INIT .F.
   DATA isSilent INIT .F.
   
   DATA oHttp, oXml, oMeter

   METHOD InitRealTime()
   METHOD InitFileTransfer()
   METHOD End()
   
   METHOD SendFiles()
   METHOD GetResponse()
   METHOD GetRoutedFiles()
   
   METHOD SendRealTimeMessage()
   METHOD GetRealTimeMessage()
   
END CLASS


//---------------------------------------------------------------------------
METHOD InitRealTime( oMeter ) CLASS InmediataWs
   LOCAL isLogHttpProgress := GetValFromRepository( "X12WebService", "LogProgress", "NO" ) $ "YES,.T., TRUE,Y"
   LOCAL nTimeOut := VAL( GetValFromRepository( "X12WebService", "TimeOut", "30000", "Timeout in milliseconds" ) )
   LOCAL cUserName:= GetValFromRepository( "X12WebService", "UsrName", "" )
   LOCAL cPassword:= GetValFromRepository( “X12WebService", "Password", "Passwrd" )
   LOCAL cUrl := GetValFromRepository( "
X12WebService", "RealTime_Eligibility_Url", ;
                  'https://www.inmediata.com/webservices/editransfer/edirealtime.asmx' )

   TRY
      //TIPClientHttp() is an xharbour native http client class maintained by Rafael Culik <culikr@gmail.com>
      //The class inherits from xharbour native class TClient()
      ::oHttp := tIPClientHTTP():new( cUrl, isLogHttpProgress )
   CATCH
      MsgStop( "
Missing SSL libs or no access to https was found.", "Check Installation" )
      RETURN NIL
   END
   
   IF ::oHttp == NIL    ;RETURN NIL    ;ENDIF

   ::oHttp:nConnTimeOut := nTimeOut
   ::cUserName := cUserName
   ::cPassword := cPassword

   ::oMeter := oMeter

   IF ::oMeter != NIL
      ::oMeter:nTotal := 100
      ::oMeter:Show()
      ::oHTTP:exGauge := { | nAt, nTotal, oSelf| ::oMeter:Set( ( Max( nAt, 0.00001 ) / Max( nTotal, 0.00001 ) ) * 100 ) }
   ENDIF

   IF ::oHttp:open()
   
      ::oHttp:hFields[ 'Content-Type'] := 'application/soap+xml; charset=utf-8'
      RETURN SELF

   ENDIF
   
RETURN NIL


//---------------------------------------------------------------------------
//The xml tree below could have been created using xharbour TXMLDocument() class
//I find it easier to simply copy the text from the .asmx page and just replace
//with the data I wish to send.

METHOD SendRealTimeMessage() CLASS InmediataWs
   LOCAL cPost
   
   cPost := ;
      '<?xml version="
1.0" encoding="utf-8"?>'+;
      '<soap12:Envelope xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">'+;
      '  <soap12:Header>'+;
      '    <AuthenticationHeader xmlns="https://www.inmediata.com/ws/EdiRealTime/">'+;
      '      <Username>' + ::cUserName + '</Username>'+;
      '      <Password>' + ::cPassword + '</Password>'+;
      '    </AuthenticationHeader>'+;
      '  </soap12:Header>'+;
      '  <soap12:Body>'+;
      '    <SendRealTime xmlns="https://www.inmediata.com/ws/EdiRealTime/">'+;
      '      <X12Data>' + ::cMessage + '</X12Data>'+;
      '    </SendRealTime>'+;
      '  </soap12:Body>'+;
      '</soap12:Envelope>'


      IF ::oHttp:Post( cPost ) ;::GetRealTimeMessage()   ;ENDIF

     
RETURN NIL

//---------------------------------------------------------------------------
METHOD GetRealTimeMessage() CLASS InmediataWs
   LOCAL oXmlDoc := TXmlDocument():New()// HBXML_STYLE_NOESCAPE )
   LOCAL cResponse
   LOCAL oXmlNode, cRet


   cResponse := ::oHttp:ReadAll()

   oXmlDoc:Read( cResponse )  //Using native xharbour TXMLDocument() class to parse the xml tree.

   oXmlNode := oXmlDoc:FindFirst( "RealTimeResponse" )
   IF oXmlNode != NIL   ;cRet := oXmlNode:cData  ;ENDIF

   oXmlNode := NIL
   oXmlDoc  := NIL

   ::cResponse := cRet

RETURN cRet

 


Here are some links to the xharbour discussion threads where I learned how to read from https webservices:
https://groups.google.com/forum/#!searc ... 4VgcN24NgJ
https://groups.google.com/forum/#!searc ... j2uSgQdr4J
https://groups.google.com/forum/#!searc ... I_AlPQP-8J

To connect to https you will need to download openSSL. Follow this link to see where to download from:
https://groups.google.com/forum/#!searc ... JXuqMbzEQJ

You will need to make tipssl.lib for your c compiler. Follow this link to learn how to make tipssl.lib:
https://groups.google.com/forum/#!searc ... tqewjy1owJ


Hope that helps,



Reinaldo.
User avatar
reinaldocrespo
 
Posts: 972
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: NG for xHarbour

Postby Antonio Linares » Tue Oct 01, 2013 8:51 am

Reinaldo,

Thanks for sharing it :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Ask Jeeves [Bot] and 78 guests