Soap Web Service

Soap Web Service

Postby byron.hopp » Tue Jan 25, 2022 12:00 am

All, I asked this same question in November of 2005:

Has anybody managed to utilize Web Services native in FiveWin without utilizing the MS Web Services Tools? I feel certain it is possible but I don't know where to start.

So I have been able to use the Microsoft Soap Toolkit 3.0, but for years now Microsoft has depreciated it. I doubt seriously it has any issues, I just think they want you to use Dot Net.

Has anybody written a class that can read WSDL files and interact with a Soap Web Service without the toolkit?

I have used JSON Style Restful Web Services (if thats what you call them) and they seem to work great, but I still have the need to access SOAP.

Thanks,

Byron ...
Thanks,
Byron Hopp
Matrix Computer Services
byron.hopp
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: Soap Web Service

Postby Antonio Linares » Tue Jan 25, 2022 11:11 pm

Byron,

Could you post a WSDL file example here ?

thanks
regards, saludos

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

Re: Soap Web Service

Postby hmpaquito » Wed Jan 26, 2022 8:53 am

hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Soap Web Service

Postby byron.hopp » Wed Jan 26, 2022 9:55 pm

WSDL file for Anitonio
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/tomichws/Service1" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://tempuri.org/tomichws/Service1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/tomichws/Service1">
<s:import namespace="http://www.w3.org/2001/XMLSchema" />
<s:element name="Process_Sql">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ConnectionString" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="sql" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="sql2" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="Process_SqlResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Process_SqlResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="ReturnDataset2">
<s:complexType />
</s:element>
<s:element name="ReturnDataset2Response">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ReturnDataset2Result">
<s:complexType>
<s:sequence>
<s:element ref="s:schema" />
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="SaveFiles">
<s:complexType />
</s:element>
<s:element name="SaveFilesResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="SaveFilesResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="Getfile">
<s:complexType />
</s:element>
<s:element name="GetfileResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetfileResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="Process_SqlSoapIn">
<wsdl:part name="parameters" element="tns:Process_Sql" />
</wsdl:message>
<wsdl:message name="Process_SqlSoapOut">
<wsdl:part name="parameters" element="tns:Process_SqlResponse" />
</wsdl:message>
<wsdl:message name="ReturnDataset2SoapIn">
<wsdl:part name="parameters" element="tns:ReturnDataset2" />
</wsdl:message>
<wsdl:message name="ReturnDataset2SoapOut">
<wsdl:part name="parameters" element="tns:ReturnDataset2Response" />
</wsdl:message>
<wsdl:message name="SaveFilesSoapIn">
<wsdl:part name="parameters" element="tns:SaveFiles" />
</wsdl:message>
<wsdl:message name="SaveFilesSoapOut">
<wsdl:part name="parameters" element="tns:SaveFilesResponse" />
</wsdl:message>
<wsdl:message name="GetfileSoapIn">
<wsdl:part name="parameters" element="tns:Getfile" />
</wsdl:message>
<wsdl:message name="GetfileSoapOut">
<wsdl:part name="parameters" element="tns:GetfileResponse" />
</wsdl:message>
<wsdl:portType name="Service1Soap">
<wsdl:operation name="Process_Sql">
<wsdl:input message="tns:Process_SqlSoapIn" />
<wsdl:output message="tns:Process_SqlSoapOut" />
</wsdl:operation>
<wsdl:operation name="ReturnDataset2">
<wsdl:input message="tns:ReturnDataset2SoapIn" />
<wsdl:output message="tns:ReturnDataset2SoapOut" />
</wsdl:operation>
<wsdl:operation name="SaveFiles">
<wsdl:input message="tns:SaveFilesSoapIn" />
<wsdl:output message="tns:SaveFilesSoapOut" />
</wsdl:operation>
<wsdl:operation name="Getfile">
<wsdl:input message="tns:GetfileSoapIn" />
<wsdl:output message="tns:GetfileSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Service1Soap" type="tns:Service1Soap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<wsdl:operation name="Process_Sql">
<soap:operation soapAction="http://tempuri.org/tomichws/Service1/Process_Sql" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="ReturnDataset2">
<soap:operation soapAction="http://tempuri.org/tomichws/Service1/ReturnDataset2" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="SaveFiles">
<soap:operation soapAction="http://tempuri.org/tomichws/Service1/SaveFiles" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Getfile">
<soap:operation soapAction="http://tempuri.org/tomichws/Service1/Getfile" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Service1">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
<wsdl:port name="Service1Soap" binding="tns:Service1Soap">
<soap:address location="http://www.matrixcomputer.com:888/service1.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
End of WSDL file for Antonio
Thanks,
Byron Hopp
Matrix Computer Services
byron.hopp
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: Soap Web Service

Postby Antonio Linares » Thu Jan 27, 2022 10:51 am

Byron,

thanks for posting it

unfortunately I don't know what you need or what to avoid

If you could post a small and self contained example, that would help a lot
regards, saludos

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

Re: Soap Web Service

Postby hmpaquito » Thu Jan 27, 2022 12:34 pm

Antonio,

No sé mucho del tema pero creo que en Delphi existe un mecanismo/ funcion que lee un wsdl y pone a disposicion (construye) del programador una jerarquia de objetos conducentes a generar los xml de acuerdo a la definicion del wsdl y sus validaciones.

Eso me pareciera que tiene una potencia asombrosa porque el ahorro en codigo es brutal. En mi caso, en su dia, solo llegué a poder validar los .xml de acuerdo con su .xsd, utilizando una clase de Rafa Carmona

Salu2
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Soap Web Service

Postby Antonio Linares » Thu Jan 27, 2022 7:44 pm

Paco,

Buscando por Delphi WSDL:
https://docwiki.embarcadero.com/RADStudio/Sydney/en/Import_WSDL_Wizard

parece que hay una utilidad que los importa:
https://docwiki.embarcadero.com/RADStudio/Sydney/en/WSDLIMP.EXE,_the_Command_Line_WSDL_Import_Tool

y un flag que hace que se genere el codigo en C++. Ni idea, pero tal vez eso ayude :-)
regards, saludos

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

Re: Soap Web Service

Postby ramirezosvaldo2 » Thu Jan 27, 2022 8:58 pm

Hello Byron

I use SoapUI, Please download it, create a SOAP project, then hit the WSDL URL that you client/provider give to you,

Then you can see all transaction, after that, you can mimic you templates ...

Let me show How I did:

LOCAL cUrl := "https://orbisws01.orbisfarma.com.mx/transaccion.asmx?WSDL"
LOCAL cAction := "https://orbisws01.orbisfarma.com.mx/setTransactionInit"

First, create a XML var ..

cXML := '<?xml version="1.0" encoding="UTF-8" standalone="no"?><SOAP-ENV:Envelope '+;
'xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:s="http://www.w3.org/2001/XMLSchema" '+;
'xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" '+;
'xmlns:tns="https://orbisws01.orbisfarma.com.mx/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" '+;
'xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" '+;
'xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" '+;
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >'+;
'<SOAP-ENV:Body><tns:setTransactionInit xmlns:tns="https://orbisws01.orbisfarma.com.mx/">'+;
'<tns:cardnumber>##CARDNUMBER##</tns:cardnumber><tns:storeid>##STOREID##</tns:storeid><tns:posid>##CAJAID##</tns:posid>'+;
'<tns:employeeid>##EMPLEADOID##</tns:employeeid><tns:key>##KEY##</tns:key></tns:setTransactionInit></SOAP-ENV:Body></SOAP-ENV:Envelope>'

Then replaces the template with their values ..

cXML := strtran( cXML , '##CARDNUMBER##',cTarjeta )
cXML := strtran( cXML , '##STOREID##',strzero(SucursalActual,3,0))
cXML := strtran( cXML , '##CAJAID##',strzero(CajaActual,1,0))
cXML := strtran( cXML , '##EMPLEADOID##','1OSVALDO')
cXML := strtran( cXML , '##KEY##',cKeyOrbisFarma)


// using Pablo Botella tools
oHttp := TServerXMLHTTPRequest():New()
oHttp:Open("POST",cURL,.F.)
oHttp:SetReQuestHeader( "SOAPAction" , cAction )
oHttp:SetReQuestHeader( "Content-Type" , "text/xml;charset=UTF-8" )
oHttp:SetReQuestHeader( "User-Agent" , ", power by Jobb-iSoft")

deletefile( "RequestActiva.xml" )

lMemowrite( "RequestActiva.xml",cXML)

oHttp:Send( cXml )
cResponse := oHttp:responseText
deletefile( "ResponseActiva.xml")

lMemowrite( "ResponseActiva.xml",cResponse)

IF oHttp:status = 200

oXml = CreateObject("Chilkat_9_5_0.Xml")
nSuccess = oXml:LoadXml(cResponse)
IF (nSuccess <> 1)
msgbox( oXml:LastErrorText )
ELSE
cId := oXml:ChilkatPath( "soap:Body|setTransactionInitResponse|setTransactionInitResult|diffgr:diffgram|NewDataSet|FirstTable|errorid|*")
cMsg:= oXml:ChilkatPath( "soap:Body|setTransactionInitResponse|setTransactionInitResult|diffgr:diffgram|NewDataSet|FirstTable|message|*")
IF val( cID ) = 0
csession := oXml:ChilkatPath( "soap:Body|setTransactionInitResponse|setTransactionInitResult|diffgr:diffgram|NewDataSet|FirstTable|transactionid|*")
cSession := cSession+"|"+oXml:ChilkatPath( "soap:Body|setTransactionInitResponse|setTransactionInitResult|diffgr:diffgram|NewDataSet|FirstTable|carditems|*")
ELSE
/// msgbox( cMsg ,"Mensaje de Orbisfarma" )
ENDIF
ENDIF

oXML:destroy()
oXML:= NIL


Let me know if you need to some help

Best Regards
Osvaldo Ramirez
ramirezosvaldo2
 
Posts: 58
Joined: Mon Jan 19, 2009 4:40 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 52 guests