John,
I am way out of my depth, but your destination URL needs to be changed
to the "URL provided in the Location field of the response"
Maybe you already knew that - and I don't see the "Location field" in your post,
so I'm no help with that . . .
when I enter "
http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfd"
in my browser, I get web page not found
HTH
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of John Allen
Sent: Saturday, June 01, 2013 7:45 AM
To: RPG400-L@xxxxxxxxxxxx
Subject: Attempting to learn Web Services (by example)
I thought I would come into the office today and see if I could learn Web Services (by example).
I am trying to use Scotts Example Program LOCWEATH
Any help or pointers would be greatly appreciated
CALL LOCWEATH PARM('30097')
Compiles Fine
I can ping to the www.weather.gov
HTTP is up and running
I am trying this on IBM i 6.1
When I run the program I get error - HTTP/1.1 301 Moved Permanently
(I have included the log file below)
Running in Debug I see the program gets to the NOAA_LatLonZipCode procedure
Variable SOAP =
....5...10...15...20...25...30...35...40...45...50...55...60
1 '<soapenv:Envelope
xmlns:xsi="
http://www.w3.org/2001/XMLSchem'
61 'a-instance"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xml'
121
'ns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/"
xmlns'
181
':ndf="
http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndf
d'
241 'XML.wsdl"> <soapenv:Header/> <soapenv:Body>
<ndf:LatLonListZ'
301 'ipCode
soapenv:encodingStyle="
http://schemas.xmlsoap.org/soa'
361 'p/encoding/"> <zipCodeList
xsi:type="xsd:string">30097</zipC'
421 'odeList> </ndf:LatLonListZipCode> </soapenv:Body>
</soapenv:'
481 'Envelope>
'
Then when http_xproc( HTTP_POINT_ADDL_HEADER
: %paddr(SoapActionLL) );
Is executed it appears to run ok
Then when rc = http_url_post_xml(
'
http://www.weather.gov/forecasts/xml/+
SOAP_server/ndfdXMLserver.php'
: %addr(SOAP) + 2
: %len(SOAP)
: *NULL
: %paddr(endTag)
: %addr(LatLon)
: HTTP_TIMEOUT
: HTTP_USERAGENT
: 'text/xml');
Is executed rc=301
and http_error(errnum);
if (errnum<>HTTP_XMLERR or x=15);
http_crash();
endif;
causes the eventual error HTTP/1.1 301 Moved Permanently
Log file:
************Beginning of data**************
HTTPAPI Ver 1.23 released 2008-04-24
OS/400 Ver V6R1M0
New iconv() objects set, PostRem=819. PostLoc=0.
ProtRem=819. ProtLoc=0
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry : 2
DNS resolver options: x'00000136'
DNS default domain: DRVTECH.COM
DNS server found: 205.152.37.23
DNS server found: 205.152.150.23
http_persist_post(): entered
http_long_ParseURL(): entered
do_post(): entered
POST /forecasts/xml/SOAP_server/ndfdXMLserver.php HTTP/1.1
Host: www.weather.gov
User-Agent: http-api/1.23
Content-Type: text/xml
Expect: 100-continue
Content-Length: 489
SOAPAction:
"
http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.w
sdl#LatLonListZipCode"
recvresp(): entered
HTTP/1.1 301 Moved Permanently
Server: Apache/2.2.15 (Red Hat)
Location:
http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.p
hp
Content-Length: 352
Content-Type: text/html; charset=iso-8859-1
Date: Sat, 01 Jun 2013 13:36:19 GMT
Connection: keep-alive
SetError() #13: HTTP/1.1 301 Moved Permanently
recvdoc parms: identity 352
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href="
http://graphical.weather.gov/xml/SOAP_server/ndfdXMLse
rver.php">here</a>.</p> < <hr> <address>Apache/2.2.15 (Red
Hat) Server at www.weather.gov Port 80</address> </body></html>
SetError() #13: HTTP/1.1 301 Moved Permanently
http_close(): entered
--
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.
As an Amazon Associate we earn from qualifying purchases.