Document / Literal (SOAP-MSG) Example

Note: This example was created for IS versions prior to 7.1. Many of these steps are no longer required in IS 7.1 due to the improvements in web services support in that release.

The following steps should help you understand how to expose a webMethods IS Flow service as a document/literal style web service. The attached IS Package contains example code of a fictional createOrder service.

  1. The service you wish to expose should accept and return document type references.
  2. Define those document types with names like “createOrderRequest” and “createOrderResponse”.
  3. Create a “container” document type for the request and response document types. The “container” document types will contain a single document type reference to the request and response document type respectively.
  4. Name the “container” document types something like “createOrderRequestType” and “createOrderResponseType”.
  5. Set the XML Namespace property on those document types to a namespace that is valid for your organization like “”. This namespace does not have to be a valid URL pointing to a real location. It’s actually helpful to NOT use a URL so that you don’t get confused over what a namespace really is.
  6. Test your service in Developer to ensure that it can be invoked successfully using data in the “request” document type and that it will return data in the “response” document type. Be sure your service uses a try-catch sequence structure to handle any exceptions.
  7. Create a document / literal “wrapper” service that extracts the content of the soap body and uses those contents to invoke your “wrapped” service. The wrapper service should have a single object input called “soapRequestData” and a single object output called “soapResponseData”
  8. Set the Universal Name properties of the wrapper service specifying the namespace used above in Step 5 for the namespace value and “createOrderRequest” for the localName property. This causes your wrapper service to be invoked when a soap request is received that contains “ns:createOrderRequest” element in the soap body where ns is a prefix associated with the namespace specified above.
  9. Write a test harness Flow service that creates a valid soap request by populating the request document type, converting it to a string, then a node and adding that node to the body of the soap request.
  10. Use the Developer debugging tools to trace through your test harness and step into your wrapper service to ensure that the payload of the soap message is being extracted and converted into your input document properly. Do not proceed until you know this is working.
  11. Open the document / literal wrapper service in Developer and choose “WSDL” from the Generate Code menu option.
  12. Select “soap-msg” from the protocol menu
  13. Specify the “container” document types as the input and output documents. In our example, that would be “createOrderRequestType” and “createOrderResponseType”
  14. Specify a valid namespace for the targetnamespace of the service. Again, I recommend not using a URL. This can be the same value as the namespace name that you used for the container document types.
  15. Save the WSDL to a location of your choosing.
  16. To test your WSDL generate a Flow service from it using a web service connector wizard or using your favorite WSDL2JAVA or .Net WSDL.EXE utility.

Note: The IS WSDL generator will not generate WSDL files that contain definitions for more than a single operation per file. To create WSDL files that do this, you’ll have to use a tool like XML Spy Enterprise Edition or the Eclipse Web Development Toolkit.

Note: This example was created for IS versions prior to 7.1. Many of these steps are no longer required in IS 7.1 due to the improvements in web services support in that release.

If this example was helpful, consider supporting wMUsers by purchasing an enhanced or premium wMUsers membership or by making a donation here.

Mark (20.6 KB)
createOrderRequest.wsdl (4.49 KB)

1 Like

The attached zip “DocLitWebServiceExample” contains an IS package with updated version of the document/literal example. This version requires IS 7.1 or later and will not work with earlier versions.

The example illustrates how to provide a simple OrderService containing three operations (createOrder, deleteOrder and getOrder). It uses the new web services descriptor node to provide the service and a separate WSD to consume the service.

I have also attached a SOAPSonar Personal Edition project file that can be used to send test requests to the IS-provided web service. You wll need to download a free copy of SOAPSonar Personal Edition from the CrossCheck Networks website.

Mark (50.5 KB) (19.6 KB)

1 Like