Re: Retrieving Request and Response from WSDL...

Jim Murphy <[email protected]> Sun, 16 Feb 2003 14:33:37 -0800
Newsgroups gmane.comp.windows.devel.soap.general
Message-ID <SOAP%[email protected]>
On Fri, 17 Jan 2003 11:42:47 -0600, Mike Andrews <[email protected]> wrote:
>Guys,
>
>Hello.
>I was wondering if anyone could tell me what I need to do to extract the
>SOAP Request and SOAP Response from a WSDL using either the SOAP Toolkit
>or the .NET framework?
>
>I need this to work in a similar manner as:
>
>http://apps.gotdotnet.com/xmltools/WsdlBrowser/

This is no simple task!  Here are the highlights...

The WSDL doesn't contain a SOAP request or response to extract but contains the metadata required to formulate a request and what the expected response could be.  There are 2 major branches to this implementation depending on the encoding style of the WSDL binding involved.  There are 2 dominant encoding styles today soap encoded and literal.  A quick scan of [1] shows you that they are about evenly divided - with literal becoming more popular.  To encoding rules for soap encoding are found in the SOAP 1.1 spec with literal most of the information is contained in the WSDL.

Assuming literal you could start at wsdl:services to find a port that has a soap:address.  From it neavigate by qname link to its binding and portType.  The portType is like an interface and contains operations that are like methods on the interface.  For a given operation you can find the input and output messages - assuming a simple request/response interaction which certainly isn't always ok to make.  The input message defines the body of the request and the output message defines the body of the response.  The messages themseleves are composed of "parts".  For rpc style operations these are the in, in/out parameters to the function for the input message and the in/out and out parameters return in the reponse for the output.

So now that you're down to the parts which are often tied to XML schema types defined/imported in the types section.  If the service takes and returns simple types like xsd:string, xsd:integer your can likely brute for the requests and responses.  If the schema is more complex involes xsd:choice or compositors with various occurence constraints or substitution groups you will need more information to generate the request - like user interaction.

Theres plenty more subtle nuances for synthesizing a soap encoded request including the use of soap's id/href pairs and soap-enc:Arrays.

Thats a quick overview - not complete but perhaps get you started?


Jim Murphy
Mindreef, Inc.
http://www.mindreef.com



[1] - http://www.xmethods.com

You can read messages from the SOAP archive, unsubscribe from SOAP, or subscribe to other
DevelopMentor lists at http://discuss.develop.com.