[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
EXAMPLE16 - HTTP/1.1 400 Bad Request
Hello everyone. In an effort to try and teach myself how to use HTTPAPI
to make a SOAP request, I have modified EXAMPLE16 to attempt to
retrieve the weather for a given zip code. Unfortunately I cannot seem
to get it to work, and I have no idea what is wrong. It is a very short
program so I'd like to ask for you to have a look and see if you can
see anything wrong with it. I've been trying to get it to work all
afternoon. Any help would be greatly appreciated. Thanks!
The WSDL for this simple Web Service is:
http//wsf.cdyne.com/WeatherWS/Weather.asmx
Here is my program:
H BNDDIR('HTTPAPI':'QC2LE')
*---------------------------------------------------------------------
----------------------------------*
* This is an example of calling a SOAP Web service w/HTTPAPI.
*
* Originally Scott's EXAMPLE16
*
*---------------------------------------------------------------------
----------------------------------*
D XAMPLE16 PR ExtPgm('XAMPLE16')
D XAMPLE16 PI
*
/copy httpapi_h
*
D Incoming PR
D rate 8F
D depth 10I 0 value
D name 1024A varying const
D path 24576A varying const
D value 65535A varying const
D attrs * dim(32767)
D const options(*varsize)
*
D SOAP s 32767A varying
D rc s 10I 0
D rate s 8F
D Result s 12P 2
*
D SUCCESS...
D S 3A inz('No ')
*
/free
http_debug(*ON);
http_XmlStripCRLF(*ON);
SOAP =
'<?xml version="1.0"?>'
+'<soapenv:Envelope'
+'xmlns:soapenv="[1]http://schemas.xmlsoap.org/soap/envelope/"'
+'xmlns:weat:"[2]http://ws.cdyne.com/WeatherWS/">'
+' <soapenv:Header/>'
+' <soapenv:Body>'
+' <weat:GetCityForecastByZIP>'
+' <weat:ZIP>90210</weat:ZIP>'
+' </weat:GetCityForecastByZIP>'
+' </soapenv:Body>'
+'</soapenv:Envelope>';
http_debug(*ON);
rc = http_url_post_xml(
'http://wsf.cdyne.com/WeatherWS/Weather.asmx'
: %addr(SOAP) + 2
: %len(SOAP)
: *NULL
: %paddr(Incoming)
: %addr(rate)
: HTTP_TIMEOUT
: HTTP_USERAGENT
: 'text/xml'
: 'http://ws.cdyne.com/WeatherWS/GetCityForecastByZIP');
if (rc <> 1);
http_crash();
else;
SUCCESS = 'Yes';
endif;
*inlr = *on;
/end-free
*
P Incoming B
D Incoming PI
D rate 8F
D depth 10I 0 value
D name 1024A varying const
D path 24576A varying const
D value 65535A varying const
D attrs * dim(32767)
D const options(*varsize)
*
D atof PR 8F extproc('atof')
D string * value options(*string)
*
/free
if (name = 'ConversionRateResult');
rate = atof(value);
endif;
/end-free
P E
I'm also attaching httpapi_debug.txt from /tmp
HTTPAPI Ver 1.24 released 2012-01-23
OS/400 Ver V6R1M0
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry : 2
DNS resolver options: x'00000136'
DNS default domain: ERBGROUP.COM
DNS server found: 192.168.2.6
DNS server found: 216.171.96.38
DNS server found: 216.16.248.50
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 /WeatherWS/Weather.asmx HTTP/1.1
Host: wsf.cdyne.com
User-Agent: http-api/1.24
Content-Type: text/xml
SOAPAction: [3]http://ws.cdyne.com/WeatherWS/GetCityForecastByZIP
Content-Length: 315
senddoc(): entered
<?xml
version="1.0"?><soapenv:Envelopexmlns:soapenv="[4]http://schemas.xmlsoa
p.org/soap/envelope/"xmlns:weat:"[5]http://ws.cdyne.com/WeatherWS/">
<soapenv:Header/> <soapenv:Body> <weat:GetCityForecastByZIP>
<weat:ZIP>90210</weat:ZIP> </weat:GetCityForecastByZIP>
</soapenv:Body></soapenv:Envelope>
recvresp(): entered
HTTP/1.1 400 Bad Request
Cache-Control: private
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Thu, 03 Jan 2013 21:39:08 GMT
Content-Length: 0
SetError() #13: HTTP/1.1 400 Bad Request
recvresp(): end with 400
recvdoc parms: identity 0
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
SetError() #13: HTTP/1.1 400 Bad Request
http_close(): entered
___________________________________________________________
Paul Reid
Application Developer III
Erb Group of Companies | 290 Hamilton Road | New Hamburg, Ontario | N3A
1A2
Phone: 519.662.6133 ext. 2363
Web: [6]http://www.erbgroup.com/
References
1. http://schemas.xmlsoap.org/soap/envelope/
2. http://ws.cdyne.com/WeatherWS/
3. http://ws.cdyne.com/WeatherWS/GetCityForecastByZIP
4. http://schemas.xmlsoap.org/soap/envelope/
5. http://ws.cdyne.com/WeatherWS/
6. http://www.erbgroup.com/
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------