0% found this document useful (0 votes)
1K views4 pages

SOAPDOC XMLDOC To Third Party Peoplecode Example

1. The document discusses testing a third party weather web service by calling its GetCityForecastByZIP operation using PeopleCode and passing a ZIP code. 2. XMLDoc and SOAPDoc classes were used to generate the SOAP request in PeopleCode. 3. Valid responses were received from the service containing weather forecast data for the given ZIP code.

Uploaded by

Ganesh Am
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF or read online on Scribd
0% found this document useful (0 votes)
1K views4 pages

SOAPDOC XMLDOC To Third Party Peoplecode Example

1. The document discusses testing a third party weather web service by calling its GetCityForecastByZIP operation using PeopleCode and passing a ZIP code. 2. XMLDoc and SOAPDoc classes were used to generate the SOAP request in PeopleCode. 3. Valid responses were received from the service containing weather forecast data for the given ZIP code.

Uploaded by

Ganesh Am
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF or read online on Scribd
You are on page 1/ 4

Test third Party intergration w/ sample Peoplecode Using XMLDoc and SOAPDoc

Database: H900GX0U 8.51.10 Used the WSDL at URL: http://wsf.cdyne.com/weatherws/weather.asmx?WSDL Consumed the WSDL for GETCITYFORECASTBYZIP Set security. The web service was obtained from http://wsf.cdyne.com/weatherws/weather.asmx which also has a sample message. 1. Tested with the service operation tester with the xml: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetCityForecastByZIP xmlns="http://ws.cdyne.com/WeatherWS/"> <ZIP>01845</ZIP> </GetCityForecastByZIP> </soap:Body> </soap:Envelope> And got a valid response. 2. Tested with the xml (let the system soap it up) <?xml version="1.0"?> <GetCityForecastByZIP xmlns="http://ws.cdyne.com/WeatherWS/"> <ZIP>01845</ZIP> </GetCityForecastByZIP> Successful response.

3. Tested with Peoplecode A. Used XMLDoc class: Local string &payload, &responseStr, &zip; Local Message &msg, &reply;

Local XmlDoc &xml;

&payload = "<?xml version='1.0'?> <GetCityForecastByZIP xmlns='http://ws.cdyne.com/WeatherWS/'>"; &zip = "01845"; &payload = &payload | "<ZIP>" | &zip | "</ZIP> </GetCityForecastByZIP>"; &xml = CreateXmlDoc(&payload); &msg = CreateMessage(Operation.GETCITYFORECASTBYZIP, %IntBroker_Request); &msg.SetXmlDoc(&xml); &reply = %IntBroker.SyncRequest(&msg); If All(&reply) Then &responseStr = &reply.GenXMLString(); MessageBox(0, "", 0, 0, &responseStr); Else MessageBox(0, "", 0, 0, "Error. No reply"); End-If;

which generated the message: <?xml version="1.0"?> <GetCityForecastByZIP xmlns="http://ws.cdyne.com/WeatherWS/"><ZIP>01845</ZIP></GetCityFore castByZIP> and with the SOAP envelope (from SOAPUP = Y on Routing Connector: <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing" ><soapenv:Body> <GetCityForecastByZIP xmlns="http://ws.cdyne.com/WeatherWS/"><ZIP>01845</ZIP></GetCityFore castByZIP></soapenv:Body> </soapenv:Envelope> And got back the reply: <?xml version="1.0"?>

<GetCityForecastByZIPResponse xmlns="http://ws.cdyne.com/WeatherWS/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <GetCityForecastByZIPResult> <Success>true</Success> <ResponseText>City Found</ResponseText> <State>MA</State> <City>North Andover</City> <WeatherStationCity>Lawrence</WeatherStationCity> <ForecastResult> <Forecast> <Date>2012-01-06T00:00:00</Date> <WeatherID>3</WeatherID> <Desciption>Mostly Cloudy</Desciption> <Temperatures> <MorningLow/> <DaytimeHigh>44</DaytimeHigh> </Temperatures> etc.

B. Using SOAPDoc: Local SOAPDoc &WthrDoc1; Local XmlDoc &request1; Local Message &msg1; Local Message &return_messages1; Local Rowset &Wthd_Rset1; Local XmlNode &EnvNode1, &MethNode1;

&WthrDoc1 = CreateSOAPDoc(); &WthrDoc1.AddEnvelope(0); rem &EnvNode1 = &WthrDoc1.EnvelopeNode;

&WthrDoc1.AddBody(); &WthrDoc1.AddMethod("GetCityForecastByZIP", 1); &MethNode1 = &WthrDoc1.MethodNode; &MethNode1.AddAttribute("xmlns", "http://ws.cdyne.com/WeatherWS/"); &Zip = "01845"; &WthrDoc1.AddParm("ZIP", &Zip); &ret1 = &WthrDoc1.ValidateSOAPDoc();

&request1 = &WthrDoc1.XmlDoc; &requeststr1 = &request1.GenFormattedXmlString(); MessageBox(0, "", 0, 0, &requeststr1); &msg1 = CreateMessage(Operation.GETCITYFORECASTBYZIP, %IntBroker_Request); &msg1.SetXmlDoc(&request1); &return_messages1 = %IntBroker.SyncRequest(&msg1); rem &Wthd_Rset = &return_mesages.getrowset(); &RetSTR1 = &return_messages1.GenXMLString(); MessageBox(0, "", 0, 0, &RetSTR1); The message generated was: <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAPENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAPENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <GetCityForecastByZIP xmlns="http://ws.cdyne.com/WeatherWS/"> <ZIP>01845</ZIP> </GetCityForecastByZIP> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Response: <?xml version='1.0'?><GetCityForecastByZIPResponse xmlns="http://ws.cdyne.com/WeatherWS/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetCityForecastByZIPRes ult><Success>true</Success><ResponseText>City Found</ResponseText><State>MA</State><City>North Andover</City><WeatherStationCity>Lawrence</WeatherStationCity><Forec astResult><Forecast><Date>2012-0106T00:00:00</Date><WeatherID>3</WeatherID><Desciption>Mostly Cloudy</Desciption><Temperatures><Mo etc.

You might also like