Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Specifying inputs and manipulating outputs of Web Service calls

Avatar

Level 1

Hello,

I am creating a process in workbench which will take a logged in users id, call a web service to get account information, and then prefill and render a form based on the resultant data. The webservice is an external SOAP webservice, and I am unsure of how to specify a variable as an input to the SOAP request in the process design or how to map the data returned in the soap message into an XML document to use for prefilling the form.

I saw this link, but am still looking for more insight: http://kb2.adobe.com/cps/499/cpsid_49980.html

Matthew

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Matthew,

I put together a sample that calls a public Web Service, maps the data from the SOAP response to a process variable of type 'xml' and renders a PDF using the xml.

I found public Web Services at http://wiki.cdyne.com/wiki/index.php?title=CDYNE_Weather which exposes WSDL at http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl and choose the operation GetCityWeatherByZIP. The operation takes a input string of ZIP code and produces the SOAP response, below.

<?xml version="1.0" encoding="UTF-8"?>

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <soap:Body>

      <GetCityWeatherByZIPResponse xmlns="http://ws.cdyne.com/WeatherWS/">

         <GetCityWeatherByZIPResult>

            <Success>true</Success>

            <ResponseText>City Found</ResponseText>

            <State>CA</State>

            <City>Sacramento</City>

            <WeatherStationCity>Roseville</WeatherStationCity>

            <WeatherID>15</WeatherID>

            <Description>N/A</Description>

            <Temperature>91</Temperature>

            <RelativeHumidity>10</RelativeHumidity>

            <Wind>MISG</Wind>

            <Pressure>N/A</Pressure>

            <Visibility/>

            <WindChill/>

            <Remarks/>

         </GetCityWeatherByZIPResult>

      </GetCityWeatherByZIPResponse>

   </soap:Body>

</soap:Envelope>

The XML document I am after is the encapsulated in the child GetCityWeatherByZIPResult so I built a schema to express that document.

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:element name="GetCityWeatherByZIPResult">

  <xsd:complexType>

   <xsd:sequence>

   <xsd:element name="Success" type="xsd:string"/>

   <xsd:element name="ResponseText" type="xsd:string"/>

   <xsd:element name="State" type="xsd:string"/>

   <xsd:element name="City" type="xsd:string"/>

   <xsd:element name="WeatherStationCity" type="xsd:string"/>

   <xsd:element name="WeatherID" type="xsd:string"/>

   <xsd:element name="Description" type="xsd:string"/>

   <xsd:element name="Temperature" type="xsd:string"/>

   <xsd:element name="RelativeHumidity" type="xsd:string"/>

   <xsd:element name="Wind" type="xsd:string"/>

   <xsd:element name="Pressure" type="xsd:string"/>

   <xsd:element name="Visibility" type="xsd:string"/>

   <xsd:element name="WindChill" type="xsd:string"/>

   <xsd:element name="Remarks" type="xsd:string"/>

   </xsd:sequence>

  </xsd:complexType>

</xsd:element>

</xsd:schema>

I then built a PDF, added a data connection to the schema GetCityWeatherByZIP.xsd and added a number of fields bound to the schema. Finally, I got on with building an ES2 process to call the Web Service, extract the GetCityWeatherByZIPResult from the SOAP response and render a PDF using the extracted XML.

process.png

The Web Service settings are depicted below.

webservice.png

I created an input process variable of type 'string' called zip and added the reference in the Web Service Request using XPath.

webservice_request.png

The SetValue service extracts a process variable of type 'xml' called cityWeatherByZIP which I loaded with the schema GetCityWeatherByZIP.xsd. The FormService renderPDFForm then uses the XML cityWeatherByZip to bind to the form. I simply invoked the process from Workbench which creates an output process variable of type 'document' depicted below.

form.png

The LiveCycle ES2 archive is attached.

Steve

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

Matthew,

I put together a sample that calls a public Web Service, maps the data from the SOAP response to a process variable of type 'xml' and renders a PDF using the xml.

I found public Web Services at http://wiki.cdyne.com/wiki/index.php?title=CDYNE_Weather which exposes WSDL at http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl and choose the operation GetCityWeatherByZIP. The operation takes a input string of ZIP code and produces the SOAP response, below.

<?xml version="1.0" encoding="UTF-8"?>

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <soap:Body>

      <GetCityWeatherByZIPResponse xmlns="http://ws.cdyne.com/WeatherWS/">

         <GetCityWeatherByZIPResult>

            <Success>true</Success>

            <ResponseText>City Found</ResponseText>

            <State>CA</State>

            <City>Sacramento</City>

            <WeatherStationCity>Roseville</WeatherStationCity>

            <WeatherID>15</WeatherID>

            <Description>N/A</Description>

            <Temperature>91</Temperature>

            <RelativeHumidity>10</RelativeHumidity>

            <Wind>MISG</Wind>

            <Pressure>N/A</Pressure>

            <Visibility/>

            <WindChill/>

            <Remarks/>

         </GetCityWeatherByZIPResult>

      </GetCityWeatherByZIPResponse>

   </soap:Body>

</soap:Envelope>

The XML document I am after is the encapsulated in the child GetCityWeatherByZIPResult so I built a schema to express that document.

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:element name="GetCityWeatherByZIPResult">

  <xsd:complexType>

   <xsd:sequence>

   <xsd:element name="Success" type="xsd:string"/>

   <xsd:element name="ResponseText" type="xsd:string"/>

   <xsd:element name="State" type="xsd:string"/>

   <xsd:element name="City" type="xsd:string"/>

   <xsd:element name="WeatherStationCity" type="xsd:string"/>

   <xsd:element name="WeatherID" type="xsd:string"/>

   <xsd:element name="Description" type="xsd:string"/>

   <xsd:element name="Temperature" type="xsd:string"/>

   <xsd:element name="RelativeHumidity" type="xsd:string"/>

   <xsd:element name="Wind" type="xsd:string"/>

   <xsd:element name="Pressure" type="xsd:string"/>

   <xsd:element name="Visibility" type="xsd:string"/>

   <xsd:element name="WindChill" type="xsd:string"/>

   <xsd:element name="Remarks" type="xsd:string"/>

   </xsd:sequence>

  </xsd:complexType>

</xsd:element>

</xsd:schema>

I then built a PDF, added a data connection to the schema GetCityWeatherByZIP.xsd and added a number of fields bound to the schema. Finally, I got on with building an ES2 process to call the Web Service, extract the GetCityWeatherByZIPResult from the SOAP response and render a PDF using the extracted XML.

process.png

The Web Service settings are depicted below.

webservice.png

I created an input process variable of type 'string' called zip and added the reference in the Web Service Request using XPath.

webservice_request.png

The SetValue service extracts a process variable of type 'xml' called cityWeatherByZIP which I loaded with the schema GetCityWeatherByZIP.xsd. The FormService renderPDFForm then uses the XML cityWeatherByZip to bind to the form. I simply invoked the process from Workbench which creates an output process variable of type 'document' depicted below.

form.png

The LiveCycle ES2 archive is attached.

Steve

Avatar

Level 1

This was perfect - thank you very much for your effort / input!

Matthew

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----