[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Soap Application using http_url_post_xml appears to be skippingAuthentication elements
Hi Kevin,
HTTPAPI doesn't attempt to understand your XML document. It simply runs
it through an EBCDIC->ASCII translation table, then copies it
byte-by-byte to the server.
It doesn't try to interpret the contents of the document, and has no
clue whatsoever what your XML tags mean or even that they're XML tags.
There's no chance that it's omitting a random XML tag in the middle of
the document.
The stuff you're seeing in debug is what the Web service has sent you in
response to your request. It's not the request itself. It's the
document generated by the server you're connected to. I tried your
program, and that response document looks like this:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<ValidateResponse
xmlns="http://validator2.AddressDoctor.com/addInteractive/Interactive">
<ValidateResult>
<ErrorCode>200</ErrorCode>
<ErrorMessage><addInteractiveRequest> tag must be
supplied.</ErrorMessage>
<ResultCount>0</ResultCount>
</ValidateResult>
</ValidateResponse>
</soap:Body>
</soap:Envelope>
Since the response document contains the tags soap:Envelope, then
soap:Body, then ValidateResponse, the path SHOULD be
/soap:Envelope/soap:Body/ValidateResponse
So HTTPAPI is doing exactly what it's supposed to.
As to why you're getting the error message... you appear to be using
incorrect namespaces.
To troubleshoot further, I suggest going to the following site:
http://www.soapclient.com/soapmsg.html
Scroll down the page to the part that says "SOAP MESSAGE GENERATOR",
it's the second fill-in form on the page.
Under "WSDL File" put
http://validator2.addressdoctor.com/addInteractive/Interactive.asmx?WSDL
Under "Method Name" put:
Validate
Then click "Generate".
At the top of the screen, it'll show you a SOAP document that should be
sent to the server. This document is what you need to create in your
RPG program (in the SOAP variable). Compare it
to what you have now to see where the error lies. Pay close attention
to the "xmlns" stuff.
When you're testing, use HTTP_url_post() (not HTTP_url_post_xml) so
that you can see the exact XML document that you're getting back from
the server. Look at HTTPAPI_H to see what the parameters for
http_url_post() are.
Once you're getting the XML document that you expect, then switch back
to HTTP_url_post_xml() to parse the XML in your program.
Two more hints:
1) There's no "Outgoing" subprocedure for HTTP_url_post_xml(). Both
procedures are for incoming documents only.
2) Your XML document should be UTF-8 Unicode, *not* ASCII. Yet,
HTTPAPI sends ASCII by default. Use HTTP_setCCSIDs(1208:0) at the
top of your program to change it to use UTF-8.
It took me a long time to debug your program for you and provide this
advice and tips. Please return the favor by helping to test HTTPAPI
1.18 beta. I need feedback in order to make a good release!
Links to the beta versions can be found here:
http://www.scottklement.com/archives/ftpapi/200704/msg00025.html
Good luck!
Kevin Walter wrote:
> Good Afternoon,
>
>
> I am very new to the concepts of xml. Nevertheless, I am trying to
> utilize a web service that will assist in the correct configuration of
> an international address, hopefully passed from one of our green
> screen apps.. The service can be found at
> [1]http://validator2.addressdoctor.com/addInteractive/Interactive.asmx
> . I have made the connection to the site with the program. What I
> see when I debug, though, is that the system works its way through the
> path (/soap:Envelope/soap:Body), the next time around, the path reads
> /soap:Envelope/soap:Body/ValidateResponse ...... and the message is
> "<addInteractiveRequest> tag must be supplied." Does the httpapi_h
> source allow for authentication? Pardon my lack of knowledge, but I'm
> clueless as to where to go here. My first order of business is to try
> to get a response from it, other than the error.
>
>
> Code looks like this:
>
>
> H DFTACTGRP(*NO) BNDDIR('HTTPAPI')
>
>
> /copy httpapi_h
>
>
> D Outgoing PR
>
> D UserData * value
>
> D depth 10I 0 value
>
> D name 1024A varying const
>
> D path 24576A varying const
>
> D attrs * dim(32767)
>
> D const options(*varsize)
>
>
> D Incoming PR
>
> D ValidatedAdd 32767A varying
>
> D depth 10I 0 value
>
> D name 1024A varying const
>
> D path 24576A varying const
>
> D value 32767A varying const
>
> D attrs * dim(32767)
>
> D const options(*varsize)
>
> D
>
> D Add_SOAPACTION PR
>
> D Header 1024A varying
>
> D UserData * value
>
> D
>
>
> D DS
>
> D SOAP s 32767a varying
>
> D x s 5s 0
>
> D rc s 10I 0
>
> D String s 2000A varying
>
> D Lang s 32A
>
> D LangMode s 41A varying
>
> D formadd s 300A varying
>
> D ValidatedAdd s 32767A varying
>
> D sact s 5s 0
>
>
>
> /free
>
> SOAP =
>
> '<?xml version="1.0" encoding="utf-8"?>'
>
> +'<soap:Envelope'
>
> +' xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'
>
> +' <soap:Body>'
>
> +' <ad:Validate'
>
> +' xmlns:ad="http://validator2.AddressDoctor.com/'
>
> + 'addInteractive/Interactive.asmx?WSDL">'
>
> +' <ad:addInteractiveRequest>'
>
> + '
> <ad:Authentication>'
>
> + '
> <ad:CustomerID>108912</ad:CustomerID>'
>
> + '
> <ad:DepartmentID>0</ad:DepartmentID>'
>
> + '
> <ad:Password>dq5Abkcu</ad:Password>'
>
> + '
> </ad:Authentication>'
>
> + '
> <ad:CampaignID>x45s</ad:CampaignID>'
>
> + ' <ad:JobToken></ad:JobToken>'
>
> + '
> <ad:Parameters>'
>
> + '
> <ad:CountryOfOrigin>COO_USA</ad:CountryOfOrigin>'
>
> + '
> <ad:StreetWithHNO>True</ad:StreetWithHNO>'
>
> + '
> <ad:CountryType>NAME_EN</ad:CountryType>'
>
> + '
> <ad:LineSeparator>LST_LF</ad:LineSeparator>'
>
> + '
> <ad:PreferredLanguage>PFL_NO_CHANGE</ad:PreferredLanguage>'
>
> + '
> <ad:Capitalization>NO_CHANGE</ad:Capitalization>'
>
> + '
> <ad:FormattedAddressWithCompany>False</ad:FormattedAddress'
>
> +
> 'WithCompany>'
>
> + '
> <ad:ParsedInput>NEVER</ad:ParsedInput>'
>
> + '
> <ad:RemoveDiacritics>False</ad:RemoveDiacritics>'
>
> + '
> </ad:Parameters>'
>
> + '
> <ad:Address>'
>
> + '
> <ad:RecordID>998887</ad:RecordID>'
>
> + ' <ad:Organization>Platon Data Technology
> GmbH</ad:Organization>'
>
> + '
> <ad:Department>Marketing</ad:Department>'
>
> + ' <ad:Contact>Sascha
> Schulz</ad:Contact>'
>
> + '
> <ad:Building></ad:Building>'
>
> + ' <ad:Street>Röntgenstr.
> 9</ad:Street>'
>
> + ' <ad:HouseNumber></ad:HouseNumber>'
>
> + '
> <ad:POBox></ad:POBox>'
>
> + '
> <ad:Locality>Maxdof</ad:Locality>'
>
> + '
> <ad:Postalcode>67133</ad:Postalcode>'
>
> + '
> <ad:Province></ad:Province>'
>
> + '
> <ad:Country>Deutschland</ad:Country>'
>
> + '
> <ad:Residue></ad:Residue>'
>
> +
> '<ad:CountrySpecificLocalityLine></ad:CountrySpecificLocalityLine>'
>
> + '
> <ad:DeliveryAddressLines></ad:DeliveryAddressLines>'
>
> + '
> <ad:FormattedAddress></ad:FormattedAddress>'
>
> + ' </ad:Address>'
>
> + '
> </ad:addInteractiveRequest>'
>
> +'
> </ad:Validate>'
>
> +' </soap:Body>'
>
> +'</soap:Envelope>';
>
>
> http_debug(*ON);
>
>
> // This tells HTTPAPI to call our subprocedure (in this example,
>
> // the subprocedure is name ADD_SOAPACTION) when assembling the
>
> // HTTP headers to send to the remote server.
>
>
> http_xproc( HTTP_POINT_ADDL_HEADER
>
> : %paddr(Add_SOAPACTION) );
>
>
> rc =
> http_url_post_xml(
>
>
> 'http://validator2.AddressDoctor.com/addInteractive/Interactive.asmx '
>
> : %addr(SOAP) +
> 2
>
> :
> %len(SOAP)
>
> :
> %paddr(Outgoing)
>
> :
> %paddr(Incoming)
>
> :
> %addr(ValidatedAdd)
>
> :
> HTTP_TIMEOUT
>
> : HTTP_USERAGENT
>
> :
> 'text/xml');
>
>
>
> if (rc <>
> 1);
>
> http_crash();
>
> else;
>
>
> http_comp(formadd);
>
> endif;
>
> *inlr =
> *on;
>
>
>
> /end-free
>
>
> P Outgoing B
>
> D Outgoing PI
>
> D UserData * value
>
> D depth 10I 0 value
>
> D name 1024A varying const
>
> D path 24576A varying const
>
> D attrs * dim(32767)
>
> D const options(*varsize)
>
> /free
>
>
> if path = '/TrackResponse/Shipment/Package' and name='Activity';
> (THIS IS SIMPLY IN THERE TO ALLOW ME TO TRACK THE PATH IN DEBUG)
>
> sact = sact + 1;
>
> endif;
>
>
> /end-free
>
>
> P E
>
>
>
> P Incoming B
>
> D Incoming PI
>
> D ValidatedAdd 32767A
> varying
>
> D depth 10I 0
> value
>
> D name 1024A varying
> const
>
> D path 24576A varying
> const
>
> D value 32767A varying
> const
>
> D attrs *
> dim(32767)
>
> D const
> options(*varsize)
>
>
>
> /free
>
> if (name =
> 'ValidateResponse');
>
> ValidatedAdd =
> value;
>
>
> endif;
>
> /end-free
>
> P
> E
>
> *
>
>
>
> P Add_SOAPACTION B
>
> D Add_SOAPACTION PI
>
> D Header 1024A varying
>
> D UserData * value
>
> /free
>
> Header = 'SOAPAction: '
>
> + 'http://validator2.AddressDoctor.com/'
>
> + 'addInteractive/Interactive/Validate'
>
> + x'0d25';
>
> /end-free
>
> P E
>
>
> Thanks, in advance. Any help would be much
> appreciated.
>
> Kevin
>
> References
>
> 1. http://validator2.addressdoctor.com/addInteractive/Interactive.asmx
>
>
>
> ------------------------------------------------------------------------
>
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list. To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------