[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New to http questions
Hi Walker,
I guess I would do the SOAP message a little differently. I'd
create a SOAP message that looks like this:
soap = '<?xml version="1.0" encoding="iso-8859-1"'
+ ' standalone="no"?>'
+ '<soap:Envelope '
+ ' xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'
+ '<soap:Body>'
+ ' <tns:processLoad '
+ ' xmlns:tns="http://services.prealert.hwy.pgl">'
+ ' <loadInfo>' + %trim(AlertData) +'</loadInfo>'
+ ' </tns:processLoad>'
+ '</soap:Body>'
+ '</soap:Envelope>';
Don't forget to encode your "AlertData" if it contains any special XML
characters (less than, greater than, ampersand characters).
Also, you'll note what the WSDL says for SoapAction:
<wsdlsoap:operation soapAction=""/>
See? It shows the SoapAction as a blank string.... so you should also
tell HTTPAPI to set a blank string (in the last parameter to
http_url_post_xml)
rc = http_url_post_xml(
'http://172.30.30.20/PreAlertWebServices/services/PreAlertServices'
: %addr(SOAP) + 2
: %len(SOAP)
: *NULL
: %paddr(Incoming)
: %addr(status)
: HTTP_TIMEOUT
: HTTP_USERAGENT
: 'text/xml'
: '' );
Good luck!
Walker Powell wrote:
> Hi, all. As a newbie, I am having a bit of a problem trying to call a web service to post some data. I'm trying to send internal data from an rpg pgm to a web service. I have been sent a wsdl describing the call.
>
> I took example 18 and then tried to substitute info from the wsdl into the soap build. Not knowing what I am supposed to substitute, other than the obvious, I'm frustrated.
>
> I got the pgm to compile, but running it produced a 404 error. I know what that means, but I think there are other problems.
>
> Would someone look at see if there is anything obvious? I am going to show the wsdl and then my mods. Please pardon the length, as it is a bit long.
>
> ----WSDL--------
> <?xml version=.0" encoding="UTF-8"?>
> <wsdl:definitions targetNamespace=ttp://services.prealert.hwy.pgl" xmlns:impl="http://services.prealert.hwy.pgl" xmlns:intf="http://services.prealert.hwy.pgl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <wsdl:types>
> <schema targetNamespace=ttp://services.prealert.hwy.pgl" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:impl="http://services.prealert.hwy.pgl" xmlns:intf="http://services.prealert.hwy.pgl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <element name=rocessLoadResponse">
> <complexType>
> <sequence>
> <element name=rocessLoadReturn" nillable="true" type="impl:ArrayOfXSDAnyType"/>
> </sequence>
> </complexType>
> </element>
> <element name=rocessLoad">
> <complexType>
> <sequence>
> <element name=oadInfo" nillable="true" type="xsd:string"/>
> </sequence>
> </complexType>
> </element>
> <complexType name=rrayOfXSDAnyType">
> <sequence>
> <element maxOccurs=nbounded" minOccurs="0" name="anyType" nillable="true" type="xsd:anyType"/>
> </sequence>
> </complexType>
> </schema>
> </wsdl:types>
> <wsdl:message name=rocessLoadRequest">
> <wsdl:part element=mpl:processLoad" name="parameters"/>
> </wsdl:message>
> <wsdl:message name=rocessLoadResponse">
> <wsdl:part element=mpl:processLoadResponse" name="parameters"/>
> </wsdl:message>
> <wsdl:portType name=reAlertServices">
> <wsdl:operation name=rocessLoad">
> <wsdl:input message=mpl:processLoadRequest" name="processLoadRequest"/>
> <wsdl:output message=mpl:processLoadResponse" name="processLoadResponse"/>
> </wsdl:operation>
> </wsdl:portType>
> <wsdl:binding name=reAlertServicesSoapBinding" type="impl:PreAlertServices">
> <wsdlsoap:binding style=ocument" transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsdl:operation name=rocessLoad">
> <wsdlsoap:operation soapAction=/>
> <wsdl:input name=rocessLoadRequest">
> <wsdlsoap:body use=iteral"/>
> </wsdl:input>
> <wsdl:output name=rocessLoadResponse">
> <wsdlsoap:body use=iteral"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:service name=reAlertServicesService">
> <wsdl:port binding=mpl:PreAlertServicesSoapBinding" name="PreAlertServices">
> <wsdlsoap:address location=ttp://172.30.30.20/PreAlertWebServices/services/PreAlertServices"/>
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
> ------------------------------
> --- My mods------
> d ALERT_DFS PR ExtPgm('ALERT_DFS')
> d AlertData 256a const
> d ALERT_DFS PI
> d AlertData 256a const
> ~~~
> ~~~
> SOAP '<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>'
> +'<SOAP:Envelope'
> +' xmlns:SOAP=ttp://schemas.xmlsoap.org/soap/envelope/"'
> +' xmlns:tns=ttp://172.30.30.20/PreAlertWebServices'
> + '/services/PreAlertServices">'
> +'<SOAP:Body>'
> +' <tns:PreAlertServices>'
> +' <tns:processLoad>'+ %trim(AlertData) + '</tns:processLoad>'
> +' </tns:PreAlertServices>'
> +'</SOAP:Body>'
> +'</SOAP:Envelope>';
>
> http_debug(*ON);
> rc =ttp_url_post_xml(
> 'http://172.30.30.20/PreAlertWebServices/services/PreAlertServices'
> : %addr(SOAP) + 2
> : %len(SOAP)
> : *NULL
> : %paddr(Incoming)
> : %addr(status)
> : HTTP_TIMEOUT
> : HTTP_USERAGENT
> : 'text/xml'
> : 'http://172.30.30.20/PreAlertWebServices/services' +
> '/PreAlertServices' + ')');
> --------------------
>
> I'm not sure just what the "tns" in in the soap body refers to. That is not in the wsdl
> Thanks for any help ... I'm really in the dark here.
> W.powell
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------