[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Webservice getCitiesByCountry
You are not posting a proper XML document
If you use SoapUI to examine the WSDL
([1]http://www.webservicex.net/globalweather.asmx?WSDL)
You'll see
<web:CountryName>?</web:CountryName>
Your doc is missing the / in the closing tag.
Charles
On Fri, Jul 4, 2014 at 9:05 AM, Jan Grove Vejlstrup <[2]jgv@xxxxxxxx>
wrote:
Hello
I'm trying to use HTTPAPI to consume this webservice:
[3]http://www.webservicex.net/globalweather.asmx?op=GetCitiesByCount
ry
This is my little program:
� � �H DFTACTGRP(*NO) ACTGRP(*new) BNDDIR('HTTPAPI')
� � �W*E CRTBNDRPG �get_cities � srcfile(*libl/qrpglesrc)
� � �W*E+ � � � DBGVIEW(*SOURCE)
� � �W*E+ � � � REPLACE(*YES)
� � �E*W
� � � /copy HTTPAPI_H
� � �d VARYINGDATAOFFSET...
� � �d � � � � � � � � c � � � � � � � � � � const(2)
� � �d SOAP � � � � � �s � � � � � 1024a � � varying
� � �d rc � � � � � � �s � � � � � � 10i 0
� � �d c_COUNTRY � � � s � � � � � � 20a � � varying
� � � /free
� � � � c_COUNTRY = 'Italy';
� � � � SOAP = '<soap:Envelope'
� � � � � � �+ '
xmlns:soap="[4]http://www.w3.org/2003/05/soap-envelope'
� � � � � � �+ ' xmlns:web="[5]http://www.webserviceX.NET">'
� � � � � � �+ ' <soap:Header/>'
� � � � � � �+ ' � <soap:Body>'
� � � � � � �+ ' � � �<web:GetCitiesByCountry>'
� � � � � � �+ ' � � � � �<web:CountryName>' + c_Country
� � � � � � �+ ' <web:CountryName>'
� � � � � � �+ ' � � �</web:GetCitiesByCountry>'
� � � � � � �+ ' � </soap:Body>'
� � � � � � �+ '</soap:Envelope>';
� � � � // http_setCCSIDs(1208 : 0);
� � � � � �http_debug(*ON:'/jgvtmp/httpapi_debug1.txt');
� � � � � �rc =
http_post('[6]http://www.webserviceX.NET/globalweather.asmx'
� � � � � � � � � � � � � � + '/GetCitiesByCountry'
� � � � � � � � � � � � � � : %addr(SOAP) +
VARYINGDATAOFFSET
� � � � � � � � � � � � � � : %len(SOAP)
� � � � � � � � � � � � � � :
'/jgvtmp/CitiesByCountry.txt'
� � � � � � � � � � � � � � : HTTP_TIMEOUT
� � � � � � � � � � � � � � : HTTP_USERAGENT
� � � � � � � � � � � � � � : 'text/xml;
charset=utf-8'
� � � � � � � � �:
'urn."[7]http://www.webserviceX.NET/GetCitiesByCountry"');
� � � � � �if (rc <> 1);
� � � � � � �http_crash();
� � � � � �endif;
� � � � � �*inlr = *on;
� � � /end-free
And this is the resulting debug-file:
HTTPAPI Ver 1.24 released 2012-01-23
OS/400 Ver V6R1M0
New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819.
ProtLoc=0
http_url_post(): entered
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry �: 2
DNS resolver options: x'00000136'
DNS default domain: WEMAG.ch
DNS server found: 195.186.1.110
http_persist_post(): entered
http_persist_req(POST) entered.
http_long_ParseURL(): entered
do_oper(POST): entered
There are 0 cookies in the cache
POST /globalweather.asmx/GetCitiesByCountry HTTP/1.1
Host: [8]www.webserviceX.NET
User-Agent: http-api/1.24
Content-Type: text/xml; charset=utf-8
SOAPAction: urn."[9]http://www.webserviceX.NET/GetCitiesByCountry"
Content-Length: 277
senddoc(): entered
<soap:Envelope
xmlns:soap="[10]http://www.w3.org/2003/05/soap-envelope
xmlns:web="[11]http://www.webserviceX.NET"> <soap:Header/>
<soap:Body> � � �<web:GetCitiesByCountry> <web:CountryName>Italy
<web:CountryName> </web:GetCitiesByCountry>
</soap:Body></soap:Envelope>
recvresp(): entered
HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Length: 236
Content-Type: text/plain; charset=utf-8
Server: Microsoft-IIS/7.0
X-AspNet-Version: 4.0.30319
X-Powered-By: [12]ASP.NET
Date: Fri, 04 Jul 2014 12:58:25 GMT
SetError() #13: HTTP/1.1 500 Internal Server Error
recvresp(): end with 500
recvdoc parms: identity 236
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
System.InvalidOperationException: Request format is invalid:
text/xml; charset=utf-8.
� �at
System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
� �at
System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
SetError() #13: HTTP/1.1 500 Internal Server Error
http_close(): entered
What am I doing wrong?
Best regards
Jan
--------------------------------------------------------------------
---
This is the FTPAPI mailing list. �To unsubscribe, please go to:
[13]http://www.scottklement.com/mailman/listinfo/ftpapi
--------------------------------------------------------------------
---
References
1. http://www.webservicex.net/globalweather.asmx?WSDL
2. mailto:jgv@xxxxxxxx
3. http://www.webservicex.net/globalweather.asmx?op=GetCitiesByCountry
4. http://www.w3.org/2003/05/soap-envelope
5. http://www.webserviceX.NET/
6. http://www.webserviceX.NET/globalweather.asmx
7. http://www.webserviceX.NET/GetCitiesByCountry
8. http://www.webserviceX.NET/
9. http://www.webserviceX.NET/GetCitiesByCountry
10. http://www.w3.org/2003/05/soap-envelope
11. http://www.webserviceX.NET/
12. http://ASP.NET/
13. 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
-----------------------------------------------------------------------