You are on page 1of 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