WebService calls with XML Documents, CDATA sections

For this sample we will create 2 processes to demonstrate how to call a webservice passing a Document to/from the webservice.  The process xml file is also attached to the page and can be imported into workbench as well as the complete application(LCA).  A WSDL that uses the xml type for a return document causes the xml document to be inserted into the SOAP response into a CDATA section in the response:

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“>
   <soapenv:Body>
      <invokeResponse xmlns=”http://adobe.com/idp/services“>
         <outDoc xmlns:ns1=”http://adobe.com/idp/services” xsi:type=”ns1:XML”>
            <document><![CDATA[<?xml version=”1.0″?>
<ns1:BankResponse decisionServiceName=”anti_fraud” xmlns:ns1=”urn:Bank”>
 ….

</document>
         </outDoc>
      </invokeResponse>
   </soapenv:Body>
</soapenv:Envelope>

 The WebService Service takes these CDATA sections and places them into a list of documents as a return type.  If there are 4 CDATA sections, there will be 4 documents returned in the CDATA list variable.  This allows calling wsdls that return XML documents.  In this example, we will create 2 Processes.  One is the service to return an xml document and the other is the calling webservice

Create a process to be used as a webservice(you may also import the attached application.lca):

  1. In workbench, create a new short lived process called echoXmlDoc.  This process will need one output variable of type xml.  This example uses the names outDoc for the output Document.
  2. Drag in the Read Resource Content service.  This will be the only Step needed in your process.
  3. Double click on the service and for the input choose the xml file to read.  This example uses /mini.xml.
  4. For the output, map the result variable to outDoc.
  5. Save and activate the process.  You should now be able to see the WSDL at http://localhost:8080/soap/services/echoXmlDoc?wsdl  if on a JBoss server, or change the port if another app server is used.

Create the process to call a webservice

 

  1. Create a short lived process called for the webservice call with the following variables:
  2.  
  3. As the first step in the process, drag in the WebServices Service.  Double Click on the WebService icon to bring up the properties pane.  Set the Web Service response variables for Response to the variable responseXml and CDATA list to the variable attachments.  In the Web Service Options tab, click on the (…) next to options to setup the webService call:
  4. You will need to load the WSDL URL for the service create above (http://localhost:8080/soap/services/echoXmlDoc?wsdl) and chose load wsdl.  You may also have to set the user name and password to invoke the service, by default the ES WSDLs are secure. 
  5. Next, Click on the request tab, Genereate the SOAP Request.  This will generate the SOAP Request with all the available parameters.  Note that you can also generate the SOAP request for the test and use the test tab to test your request:
  6. We can now chose OK to exit out of the Web Service Options
  7. Next, Drag in the Set Value Service after the Web Service.  Double click on Set Value service to bring up the properties page.  We need to map the output document to the first document in the attachments list.  This is done by setting the location /process_data/@outDoc to the expression /process_data/attachments[1]

 

Webservice-calls-with-xml-documents with Application and Process Files

September 10, 2008 at 6:40 pm Leave a comment

WebService calls using MIME attachments

For this sample we will create 2 processes to demonstrate how to call a webservice passing a Document to/from the webservice using MIME attachments.  The process xml file is also attached to the page and can be imported into workbench.  There is also a complete application(LCA) in the same document.

Create a process to be used as a webservice:

  1. In workbench, create a new short lived process called echoDoc.  This process will need 1 input variable of type Document and one output variable of type Document.  This example uses the names inDoc for the input Document and outDoc for the output Document.
  2. Drag in the Set Value service.  This will be the only Step needed in your process.
  3. Double click on the Set Value service in your process, and select the ‘+’ for a new mapping.  You will need to map the location of the output document to the input document.  Set the location: /process_data/@outDoc to the Expression /process_data/@inDoc.  This simply “echos” the document passed in.
  4. Save and activate the process.  You should now be able to see the WSDL at http://localhost:8080/soap/services/echoDoc?wsdl  if on a JBoss server, or change the port if another app server is used.

Create the process to call a webservice passing documents as MIME attachments

 

  1. Create a short lived process called for the webservice call with the following variables:
  2. As the first step in the process, drag in the WebServices Service.  Double Click on the WebService icon to bring up the properties pane.  Set the Web Service response variables for Response to the variable responseXml and Attachments to the variable attachments.  In the Web Service Options tab, click on the (…) next to options to setup the webService call:
  3. You will need to load the WSDL URL for the service create above (http://localhost:8080/soap/services/echoDoc?wsdl) and chose load wsdl.  You may also have to set the user name and password to invoke the service, by default the ES WSDLs are secure.  You also need to append ?blob=mime to the target URL to tell ES to return the document in MIME.  See the link for the technote below for a description of these options.
  4. Next, Click on the request tab, select Include optional and Genereate the SOAP Request.  This will generate the SOAP Request with all the available parameters.  We will need to only fill in the values for attachmentID and remove the extra Optional elements. We will set attachmentID to part0 as  <ser:attachmentID>part0</ser:attachmentID>:
  5. Next, click on the attachments tab and choose Load Attachment Parts.  This will call the ES WSDL and show the types available.  The attachment parts are labeled part0..partN for each attachment.  In this case we have one attachment which is labeled part0, which is the name name we used in the request above.  We will also need to map this to our input document /process_data/@inDoc.  Do this by clickin on the (…) in the attachment row of part0.  We can now chose OK to exit out of the Web Service Options:
  6. Next, Drag in the Set Value Service after the Web Service.  Double click on Set Value service to bring up the properties page.  We need to map the output document to the first document in the attachments list.  This is done by setting the location /process_data/@outDoc to the expression /process_data/attachments[1]

 

There is also a technote kb403973 on attachments at http://kb.adobe.com/selfservice/viewContent.do?externalId=kb403973&sliceId=1

 

 Webservice-calls-using-mime Attachment with Application and Process Files

September 10, 2008 at 5:04 pm Leave a comment

Using Documents with JDBC Service

Steps in this example:

  1. Using the JDBC Service Execute, create a table to test with using CREATE TABLE doc_test(doc LONGBLOB).  This will create a table called doc_test with the single column called doc.
  2. Using the JDBC Execute, use a parameterized query to set the document from process data into the SQL statement, ie – INSERT INTO doc_test(doc) VALUES (?).  You need to check the Use Parameterized query, select the type BLOB and select the process data for your document:
  3. Using the JDBC Query Single, select the document from the database and map its value to a process data variable.  SQL Statement:  SELECT doc from doc_test.  Click on the Data Mapping and select Parse Query.  This should enter the defaults for your Select Statement.  You will then need to map to the process variable for your document:
  4. Link to Attachments for process file and lca Using-documents-with-jdbc

August 19, 2008 at 7:47 pm Leave a comment

WebService calls using base64 Documents

For this sample we will create 2 processes to demonstrate how to call a webservice passing a Document to/from the webservice.  The process xml file is also attached to the page and can be imported into workbench.

Create a process to be used as a webservice:

  1. In workbench, create a new short lived process called echoDoc.  This process will need 1 input variable of type Document and one output variable of type Document.  This example uses the names inDoc for the input Document and outDoc for the output Document.
  2. Drag in the Set Value service.  This will be the only Step needed in your process.
  3. Double click on the Set Value service in your process, and select the ‘+’ for a new mapping.  You will need to map the location of the output document to the input document.  Set the location: /process_data/@outDoc to the Expression /process_data/@inDoc.  This simply “echos” the document passed in.
  4. Save and activate the process.  You should now be able to see the WSDL at http://localhost:8080/soap/services/echoDoc?wsdl  if on a JBoss server, or change the port if another app server is used.

Create the process to call a webservice passing documents base 64 encoded

 

  1. Create a short lived process called for the webservice call with the following variables:
  2. As the first step in the process, drag in the Set Value Service and set the following mappings, Set the Content type variable (/process_data/@contentType) to the input document content type using the document function getDocContentType (getDocContentType(/process_data/@inDoc)).  Set the base 64 variable (/process_data/@docBase64) using the getDocContentBase64 function to get the contents of the input document in base64 (getDocContentBase64(/process_data/@inDoc)):
  3. Next, Drag in the service WebService and click on the Options in the Web Service Options pane.  You will need to load the WSDL URL for the service create above (http://localhost:8080/soap/services/echoDoc?wsdl) and chose load wsdl.  You may also have to set the user name and password to invoke the service, by default the ES WSDLs are secure.  You also need to append ?blob=base64 to the target URL to tell ES to return the document in base64:
  4. Next, Click on the request tab, select Include optional and Genereate the SOAP Request.  This will generate the SOAP Request with all the available parameters.  We will need to only fill in the values for contentType, binaryData and remove the extra Optional elements.  Set the contentType element to {$/process_data/@contentType$} and the binaryData to {$/process_data/@docBase64$}.  Note that the attachmentID and remoteURL elements are optional and removed:
  5. Last we will need to drag in another Set Value service to pull out the Base64 encoded document from the Soap Response and set the content type of the new document.  We need to set the outDoc variable using the getDocFromBase64 function passing in the binaryData element from the Soap response:
  6. Last, we should activate and invoke the process.

There is also a technote kb403973 on attachments at http://kb.adobe.com/selfservice/viewContent.do?externalId=kb403973&sliceId=1

 Document with attachments with application Webservice-calls-using-base64

 

August 19, 2008 at 6:01 pm Leave a comment

Hello world!

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

July 10, 2008 at 9:31 pm 1 comment


Categories

  • Blogroll

  • Feeds