Communication via HTTP with SOAP

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Communication via HTTP with SOAP

Post by mol »

Hi guys!
I need to retrieve some data via SOAP protocol from my hmg app.
Has anyone any sample how to start with this?
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Communication via HTTP with SOAP

Post by mol »

I'm trying to build small sample, but I get linker error:

Code: Select all

Harbour 3.2.0dev (r1601151502)
Copyright (c) 1999-2015, http://harbour-project.org/
d:/hmg343/harbour/lib/win/mingw/libhbcurl.a(core.o):core.c:(.text+0x667): undefined reference to `_imp__curl_easy_setopt'
d:/hmg343/harbour/lib/win/mingw/libhbcurl.a(core.o):core.c:(.text+0x7a0): undefined reference to `_imp__curl_formfree'
d:/hmg343/harbour/lib/win/mingw/libhbcurl.a(core.o):core.c:(.text+0x7be): undefined reference to `_imp__curl_slist_free_all'
I've added libhburl.a to compilation.

Anyone has an idea which library should I append to project?
mlnr
Posts: 126
Joined: Fri Aug 28, 2015 1:52 pm
DBs Used: DBF

Re: Communication via HTTP with SOAP

Post by mlnr »

Hi Marek,

Please, take a look at the link below.

viewtopic.php?f=5&t=4617&start=10#p45742

DanielMaximilano wrote that how can compile with CURL.
Best regards,
Gabor
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Communication via HTTP with SOAP

Post by mol »

Thanks for pinting me this topic, I've missed it.
@danielmaximiliano: why we need to compile libhbcurl.a - it is present in harbour\lib folder?
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Communication via HTTP with SOAP

Post by Pablo César »

The libhbcurl.a is at \hmg.3.4.3\HARBOUR\lib\win\mingw

I think you should put in "Configuration" TAB of IDE like this:

Libs = hbcurl (always removing first "lib" from the complete name of file)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Communication via HTTP with SOAP

Post by mol »

I put it in configuration, but, errors from linker point the problem within this lib:

Code: Select all

d:/hmg343/harbour/lib/win/mingw/libhbcurl.a(core.o):core.c:(.text+0x667): undefined reference to `_imp__curl_easy_setopt'
mlnr
Posts: 126
Joined: Fri Aug 28, 2015 1:52 pm
DBs Used: DBF

Re: Communication via HTTP with SOAP

Post by mlnr »

try this

libs=hbcurls
libs=hbcurl
libs=libcurl
Best regards,
Gabor
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Communication via HTTP with SOAP

Post by Pablo César »

mol wrote: Thu Feb 23, 2017 6:14 am I put it in configuration, but, errors from linker point the problem within this lib:
d:/hmg343/harbour/lib/win/mingw/libhbcurl.a(core.o):core.c:(.text+0x667): undefined reference to `_imp__curl_easy_setopt'
Probably is because is not found the lib...

Try with putting extra:

libpaths=\hmg.3.4.3\HARBOUR\lib\win\mingw
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Communication via HTTP with SOAP

Post by mol »

Have sb. idea about SOAP communication?
1. Establish session - login to webservice
2. Send request
3. Retrieve data
4. Close communication

Maybe a little sample?
mlnr
Posts: 126
Joined: Fri Aug 28, 2015 1:52 pm
DBs Used: DBF

Re: Communication via HTTP with SOAP

Post by mlnr »

Here is little help from Harbour forum.
https://groups.google.com/forum/#!searc ... relevance.

I found an example. (soap-example.zip)

I'm use CURL to POST REQUEST HTTP communication, but I dont' use SOAP. So, i'm not an expert.

I wrote modeled on the example program. I hope it works. ;)

Code: Select all

function soapLogin(_UserName,_UserPassword,_OwnerVatNumber)

local cxml,canswer

cxml := '<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sds2GInterface-IsdsGateway">'+chr(13)+chr(10)
cxml += '   <soapenv:Header/>'+chr(13)+chr(10)
cxml += '   <soapenv:Body>'+chr(13)+chr(10)
cxml += '    <urn:Login soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'+chr(13)+chr(10)
cxml += '     <UserName xsi:type="xsd:string" xs:type="type:string" xmlns:xs="http://www.w3.org/2000/XMLSchema-instance">'+_UserName+'</UserName>'+chr(13)+chr(10)
cxml += '     <UserPassword xsi:type="xsd:string" xs:type="type:string" xmlns:xs="http://www.w3.org/2000/XMLSchema-instance">'+_UserPassword+'</UserPassword>'+chr(13)+chr(10)
cxml += '     <OwnerVatNumber xsi:type="xsd:string" xs:type="type:string" xmlns:xs="http://www.w3.org/2000/XMLSchema-instance">'+OwnerVatNumber+'</OwnerVatNumber>'+chr(13)+chr(10)
cxml += '    </urn:Login>'+chr(13)+chr(10)
cxml += '   </soapenv:Body>'+chr(13)+chr(10)
cxml += '</soapenv:Envelope>'+chr(13)+chr(10)

canswer := fHttpExecute(cxml)
canswer := strtran(canswer,"><",">"+chr(10)+"<")
memowrit("soapanswer.xml",canswer)

xml_read("soapanswer.xml")
Return _SessionID

**********************************************

Function soapLogout(_SessionID)

  local cxml,canswer

cxml := '<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sds2GInterface-IsdsGateway">'+chr(13)+chr(10)
cxml += '   <soapenv:Header/>'+chr(13)+chr(10)
cxml += '   <soapenv:Body>'+chr(13)+chr(10)
cxml += '    <urn:Logout soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'+chr(13)+chr(10)
cxml += '     <SessionID xsi:type="xsd:string" xs:type="type:string" xmlns:xs="http://www.w3.org/2000/XMLSchema-instance">'+_SessionID+'</SessionID>'+chr(13)+chr(10)
cxml += '    </urn:Logout>'+chr(13)+chr(10)
cxml += '   </soapenv:Body>'+chr(13)+chr(10)
cxml += '</soapenv:Envelope>'+chr(13)+chr(10)

  canswer := fHttpExecute(cxml)
  canswer := strtran(canswer,"><",">"+chr(10)+"<")
  memowrit("soapanswer.xml",canswer)
  
  xml_read("soapanswer.xml")

Return .T.
Attachments
soap-example.zip
(84.74 KiB) Downloaded 268 times
Best regards,
Gabor
Post Reply