Help with SOAP ! ( Servoy 5.1 beta)

Hello !

I have a problem with http post to a soap server . Can anyone help me ?

I need to post this RAW code ( works with SOAP Client ! ).


Host: sampleshop.com
User-Agent: Mac OS X; WebServicesCore.framework (1.1.0)
Content-Type: text/xml
Soapaction: Webservices#SOAP_test

<?xml version="1.0" encoding="UTF-8"?>

<SOAP-ENV:Envelope
xmlns:xsd=“http://www.w3.org/2001/XMLSchema
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xmlns:SOAP-ENC=“http://schemas.xmlsoap.org/soap/encoding/
SOAP-ENV:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/
xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/”>
SOAP-ENV:Body
<m:SOAP_Article_getInformation xmlns:m=“http://www.adomain.com”>
<customer_number xsi:type=“xsd:string”>123456</customer_number>
<customer_password xsi:type=“xsd:string”>123456</customer_password>
<mandant_id xsi:type=“xsd:int”>1</mandant_id>
<language_nr xsi:type=“xsd:int”>1</language_nr>
<article_number xsi:type=“xsd:string”>ABC-123</article_number>
</m:SOAP_test>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

my code:

function soap () {

//same as raw code + \n

var httpCode=
‘<?xml version="1.0" encoding="UTF-8"?>’ + ‘\n’
‘<SOAP-ENV:Envelope’ + ‘\n’
‘xmlns:xsd=“http://www.w3.org/2001/XMLSchema”’ + ‘\n’
‘xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”’ + ‘\n’
‘xmlns:SOAP-ENC=“http://schemas.xmlsoap.org/soap/encoding/”’ + ‘\n’
‘SOAP-ENV:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”’ + ‘\n’
‘xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/”>’ + ‘\n’
SOAP-ENV:Body’ + ‘\n’
‘<m:SOAP_Article_getInformation xmlns:m=“http://www.adomain.com”>’ + ‘\n’
‘<customer_number xsi:type=“xsd:string”>123456</customer_number>’ + ‘\n’
‘<customer_password xsi:type=“xsd:string”>123456</customer_password>’ + ‘\n’
‘<mandant_id xsi:type=“xsd:int”>1</mandant_id>’ + ‘\n’
‘<language_nr xsi:type=“xsd:int”>1</language_nr>’ + ‘\n’
‘<article_number xsi:type=“xsd:string”>ABC-123</article_number>’ + ‘\n’
‘</m:SOAP_test>’ + ‘\n’
‘</SOAP-ENV:Body>’ + ‘\n’
‘</SOAP-ENV:Envelope>’

var poster = plugins.ttp.getposter(‘http://hereitisposted.com/SOAP/’)

poster.addHeader (‘Host’,‘http://hereitispostedto.com’)
poster.addHeader (‘User-Agent’, ‘Agent’)
poster.addHeader (‘Content-type’,‘text/xml; charset=utf-8’)
poster.addHeaeer (‘Soapaction’,‘Webservices#SOAP_test’)

httpCode = poster.doPost ();

var result = poster.getPageData();


I got the Soap response: NO XML was provided

Where is the error ?

Thank you in advance

Rainer Boehm

you must specify the xml you post:

poster.addParameter(null,httpCode)

(before doPost).

Great Support ! Thank you !

Works…

rainer / dsp:
poster.addHeader (‘Host’,‘http://hereitispostedto.com’)
poster.addHeader (‘User-Agent’, ‘Agent’)
poster.addHeader (‘Content-type’,‘text/xml; charset=utf-8’)
poster.addHeader (‘Soapaction’,‘Webservices#SOAP_test’)

httpCode = poster.doPost ();

var result = poster.getPageData();

I don’t see .addHeader function in Poster (Servoy 3.x). Can we use addParameter?

Hi Tony,

antonio:
I don’t see .addHeader function in Poster (Servoy 3.x). Can we use addParameter?

.addHeader is a newly added function in Servoy 5.1. .addParameter will not do the same thing.
I suggest you upgrade to 5.1 (especially because 3.5 will be unsupported soon).

Thanks for the response Robert. I’m in the process of upgrading to 5.1 but in the meantime I have a pressing need to access this with 3.x

The SOAP example I need to adapt looks like this - is there a way to achieve in 3.x?

The following is a sample SOAP 1.1 request and response. The placeholders need to be replaced with actual values.

POST /catalystwebservice/catalystcrmwebservice.asmx HTTP/1.1
Host: help.worldsecuresystems.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/CatalystDeveloperService/CatalystCRMWebservice/ContactList_Retrieve"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <ContactList_Retrieve xmlns="http://tempuri.org/CatalystDeveloperService/CatalystCRMWebservice">
      <username>USERNAME</username>
      <password>PASSWORD</password>
      <siteId>12345</siteId>
      <lastUpdateDate>2010-04-01T15:27:00</lastUpdateDate>
      <recordStart>0</recordStart>
      <moreRecords>boolean</moreRecords>
    </ContactList_Retrieve>
  </soap:Body>
</soap:Envelope>

Hi Tony,

As a quick work-around you could try to use the 5.1 http plugin under 3.5. Not sure if it works (and it’s not supported) but you could try.

Hope this helps.