Navision 2009 sp1 Web service Integration With soap
dnvpraveen
Member Posts: 6
Hi to all,
I new to web services.
i googled and found one soap API. which is http://www.weather.gov/forecasts/xml/do ... Series.xml
by calling this SOAP request i will get a response of
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns2199:GmlTimeSeries xmlns:ns2199="uri:DWMLgen">
<listLatLon xsi:type="xsd:string">38.99,-77.02 39.70,-104.80 47.6,-122.30</listLatLon>
<startTime xsi:type="xsd:string">2000-01-01T00:00:00</startTime>
<endTime xsi:type="xsd:string">2010-01-01T00:00:00</endTime>
<compType xsi:type="xsd:string">Between</compType>
<featureType xsi:type="xsd:string">Forecast_Gml2Point</featureType>
<propertyName xsi:type="xsd:string">maxt,mint</propertyName>
</ns2199:GmlTimeSeries>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Defined variable are
Name DataType Subtype Length
locautXmlDoc Automation 'Microsoft XML, v6.0'.DOMDocument
locautXmlHttp Automation 'Microsoft XML, v6.0'.XMLHTTP
test Text 250
and i coded in the code unit run tiger
//HTTP Start
// main method new
IF ISCLEAR(locautXmlDoc) THEN
CREATE(locautXmlDoc);
locautXmlDoc.async:=FALSE;
locautXmlDoc.loadXML('<?xml version="1.0" encoding="ISO-8859-1" ?>'
+'- <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" '
+'xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"'
+'xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
+'xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">'
+'http://www.weather.gov/forecasts/xml/docs/SOAP_Requests/GmlTimeSeries.xml');
locautXmlHttp.send(locautXmlDoc);
locautXmlDoc.load(locautXmlHttp.responseXML);
locautXmlDoc.save(test);
MESSAGE(test);
While running error pops up at locautXmlHttp.send(locautXmlDoc); error message is (“The Automation variable has not been instantiated.”).
My intension is to consume this web service and print the out put.
Please Help Me to resolve this issue.
I new to web services.
i googled and found one soap API. which is http://www.weather.gov/forecasts/xml/do ... Series.xml
by calling this SOAP request i will get a response of
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns2199:GmlTimeSeries xmlns:ns2199="uri:DWMLgen">
<listLatLon xsi:type="xsd:string">38.99,-77.02 39.70,-104.80 47.6,-122.30</listLatLon>
<startTime xsi:type="xsd:string">2000-01-01T00:00:00</startTime>
<endTime xsi:type="xsd:string">2010-01-01T00:00:00</endTime>
<compType xsi:type="xsd:string">Between</compType>
<featureType xsi:type="xsd:string">Forecast_Gml2Point</featureType>
<propertyName xsi:type="xsd:string">maxt,mint</propertyName>
</ns2199:GmlTimeSeries>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Defined variable are
Name DataType Subtype Length
locautXmlDoc Automation 'Microsoft XML, v6.0'.DOMDocument
locautXmlHttp Automation 'Microsoft XML, v6.0'.XMLHTTP
test Text 250
and i coded in the code unit run tiger
//HTTP Start
// main method new
IF ISCLEAR(locautXmlDoc) THEN
CREATE(locautXmlDoc);
locautXmlDoc.async:=FALSE;
locautXmlDoc.loadXML('<?xml version="1.0" encoding="ISO-8859-1" ?>'
+'- <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" '
+'xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"'
+'xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
+'xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">'
+'http://www.weather.gov/forecasts/xml/docs/SOAP_Requests/GmlTimeSeries.xml');
locautXmlHttp.send(locautXmlDoc);
locautXmlDoc.load(locautXmlHttp.responseXML);
locautXmlDoc.save(test);
MESSAGE(test);
While running error pops up at locautXmlHttp.send(locautXmlDoc); error message is (“The Automation variable has not been instantiated.”).
My intension is to consume this web service and print the out put.
Please Help Me to resolve this issue.
0
Comments
-
Of course, have you read the error? It is very clear...
Whas is not clear on this error? You need to instantiate the automation variable first before you use it...The Automation variable has not been instantiated0 -
Thanks man,
i have corrected the code
IF ISCLEAR(locautXmlDoc) THEN
CREATE(locautXmlDoc);
locautXmlDoc.async:=FALSE;
IF ISCLEAR(locautXmlHttp) THEN
CREATE(locautXmlHttp);
locautXmlHttp.open('post','http://www.weather.gov/forecasts/xml/docs/SOAP_Requests/GmlTimeSeries.xml');
locautXmlHttp.send('http://www.weather.gov/forecasts/xml/docs/SOAP_Requests/GmlTimeSeries.xml');
locautXmlDoc.load(locautXmlHttp.responseXML);
locautXmlDoc.save('d:\NHW\Ws.xml');
Without a error code unit runs But XML empty file created.
I also checked HTTP Debugger. Debugger showing response .
Can you help me in this.0 -
Try to send the request as synchronous (parameter of the send), I am not sure what is default, it seems that asynchronous...0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
