× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I just did our first SOAP project & it can be frustrating figuring out the
SOAP request.

We used the SOAPUI to build the syntax & once it ran under there, I just
duplicated it EXACTLY as it was in the UI.

We did not use the <tns: tags, try making it look exactly like the code in
your UI and see how it goes.




On Thu, Apr 14, 2016 at 5:13 PM, Charles Wilt <charles.wilt@xxxxxxxxx>
wrote:

You should direct this question to Scott's FTP & HTTP API list

http://www.scottklement.com/mailman/listinfo/ftpapi

Once there, you may want to look into Thomas Raddatz's WSDL2RPG utility
builds an RPGLE interface for the web service from the WSDL for you to use.
http://www.tools400.de/English/Freeware/WSDL2RPG/wsdl2rpg.html

WSDL2RPG uses Scott's HTTP API to communicate, and is also supported on
Scott's list.

Charles

On Thu, Apr 14, 2016 at 4:08 PM, <RWesh@xxxxxxxxxxx> wrote:

Good Afternoon

I am attempting to communicate with SalesForce's SOAP API via RPGLE and
using Scott Klement's presentations as a guide.
I am having some difficulty and as there is quite a bit I don't
understand
I am hoping someone would be able to help.



http://www.scottklement.com/presentations/Web%20Services%20from%20RPG%20with%20HTTPAPI.pdf


I have successfully generated a WSDL and performed a login request as a
test via SOAPUI
I am now attempting to write code in RPGLE using HTTPAPI to duplicate
that
same XML that seemed to work so well, but I receive errors and I'm unsure
about a few things.


1) Can I not use the exact same soap message that worked correctly in
SOAPUI within my RPGLE code? I notice the presentation uses "tns:" suffix
whereas SOAPUI uses "urn:"

2) This goes along with question 1 but are there certain standards I
should be using in RPGLE for SOAP? For example, Scott uses <SOAP:Header>
whereas SOAPUI uses <soapenv:Header>



Below you can also find my constructed SOAP message and post which I
changed stuff around to emulate the examples I saw in the presentation.

Thank you for any assistance that can be provided



Successful SOAPUI XML
<soapenv:Envelope xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/
" xmlns:urn="urn:enterprise.soap.sforce.com">
<soapenv:Header>
<urn:organizationId>secret</urn:organizationId>
</soapenv:Header>
<soapenv:Body>
<urn:login>
<urn:username>username</urn:username>
<urn:password>PasswordSecurityToken</urn:password>
</urn:login>
</soapenv:Body>
</soapenv:Envelope>




RPGLE snippet
SOAP =
'<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>'
+'<SOAP:Envelope'
+' xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/";'
+' xmlns:tns="tns:enterprise.soap.sforce.com">'
+'<SOAP:Header>'
+'<tns:organizationId>ID</tns:organizationId>'
+'</SOAP:Header>'
+'<SOAP:Body>'
+'<tns:login>'
+'<tns:username>username</tns:username>'
+'<tns:password>PasswordSecurityToken</tns:password>'
+'</tns:login>'
+'</SOAP:Body>'
+'</SOAP:Envelope>';

rc = http_url_post(
'https://test.salesforce.com/services/Soap/c/36.0/0DFZ00000008P
: %addr(SOAP) + 2
: %len(SOAP)
: '/tmp/SalesforceTest.soap'
: HTTP_TIMEOUT
: HTTP_USERAGENT
: 'text/xml'
: ' ');

httpapi_debug.txt
SetError() #13: HTTP/1.1 500 Server Error
recvresp(): end with 500
recvdoc parms: identity 287
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="
http://scchemas.xmlsoap.org/soap/envelope/


"><soapenv:Body><soapenv:Fault><faultcode>soapeenv:Client</faultcode><faultstring>SOAPAction
HTTP header missing</faultstring>
</soapenv:Fault></soapenv:Body></soapenv:Envelope>

My SOAPAction in the post is blank because SOAPUI shows me that
"SOAPACTION" is blank as well.




This document should only be read by those persons to whom it is
addressed
and is not intended to be relied upon by any person without subsequent
written confirmation of its contents. Accordingly, Sumitomo Machinery
Corporation disclaims all responsibility and accept no liability
(including
in negligence) for the consequences for any person acting, or refraining
from acting, on such information prior to the receipt by those persons of
subsequent written confirmation. If you have received this e-mail
message
in error, please notify us immediately by telephone. Please also destroy
and delete the message from your computer. Any form of reproduction,
dissemination, copying, disclosure, modification, distribution and/or
publication of this e-mail message is strictly prohibited.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.