0% found this document useful (0 votes)
64 views

SOAPDOC XMLDOC To Third Party Example

The document discusses testing a third-party weather web service integration using PeopleCode. It tests consuming the web service WSDL to call the GETCITYFORECASTBYZIP operation using sample XML payloads. It then tests calling the operation from PeopleCode using both the XMLDoc and SOAPDoc classes, and validates successful responses are received.

Uploaded by

Madhu Mandava
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views

SOAPDOC XMLDOC To Third Party Example

The document discusses testing a third-party weather web service integration using PeopleCode. It tests consuming the web service WSDL to call the GETCITYFORECASTBYZIP operation using sample XML payloads. It then tests calling the operation from PeopleCode using both the XMLDoc and SOAPDoc classes, and validates successful responses are received.

Uploaded by

Madhu Mandava
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT 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></GetCityForecastByZIP>

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></GetCityForecastByZIP></soape
nv: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:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="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"><GetCityForecastByZIPResult><Success>tru
e</Success><ResponseText>City Found</ResponseText><State>MA</State><City>North
Andover</City><WeatherStationCity>Lawrence</WeatherStationCity><ForecastResult><Forecas
t><Date>2012-01-06T00:00:00</Date><WeatherID>3</WeatherID><Desciption>Mostly
Cloudy</Desciption><Temperatures><Mo etc.

You might also like