Ask the Expert

Using MS SOAP toolkit to generate Web services, part 2

I want to use MS SOAP toolkit to generate Web services. I have VC++ DLL that I want to use to generate WSDL and WSML files using WSDL generator. Problem is that I want to use a document style Web service instead of default RPC style. I can change style attributes in generated WSDL file to document style. What other things will have to change?

What is the SOAP client code? If you have some code sample for a document style SOAP call, could you please send it to me?


    Requires Free Membership to View

Continued from part 1.

So for example, given an operation named "test" that takes two strings in and returns a string, in RPC/encoded, it would be defined like this:

<wsdl:message name="testRequest">
   <wsdl:part name="input1" type="xsd:string"/>
   <wsdl:part name="input2" type="xsd:string"/>
 </wsdl:message>
 <wsdl:message name="testResponse">
   <wsdl:part name="output" type="xsd:string"/>
 </wsdl:message>

For document/literal, you would change it to:

<wsdl:types>
   <xsd:schema name="testSchema" targetNamespace="urn:testNS">
     <xsd:element name="test" type="tTest"/>
     <xsd:complexType name="tTest">
       <xsd:sequence>
         <xsd:element name="input1" type="xsd:string"/>
         <xsd:element name="input2" type="xsd:string"/>
       </xsd:sequence>
     </xsd:complexType>
     <xsd:element name="testReturn" type="tTestReturn"/>
     <xsd:complexType name="tTestReturn">
       <xsd:sequence>
         <xsd:element name="output" type="xsd:string"/>
       </xsd:sequence>
     </xsd:complexType>
   </xsd:schema>
 </wsdl:types>
 <wsdl:message name="testRequest">
   <wsdl:part name="parameters" element="tns:test"/>
 </wsdl:message>
 <wsdl:message name="testResponse">
   <wsdl:part name="parameters" element="tns:testReturn"/>
 </wsdl:message>
  • In the <wsdl:binding> definition, make the following changes:

    • In <soap:binding>, change the style attribute to "document".
    • In <soap:operation>, changes the style attribute to "document".
    • In <soap:body> definitions, change the use attribute to "literal", and remove the namespace attribute and the encodingStyle attribute.

    Following the same example, for an RPC/encoded that's specified like this:

     
             <wsdl:binding name='testBinding' 
    
              type='tns:testInterface'>
    
            <soap:binding 
    
                  transport='http://schemas.xmlsoap.org/soap/http' 
    
                  style='rpc'/>
    
            <wsdl:operation name='test'>
    
                <soap:operation 
    
                    soapAction='urn:test' 
    
                    style='rpc'/>
    
                <wsdl:input>
    
                    <soap:body use='encoded'
     
                        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
     
                        namespace='urn:testNS'/>
    
                </wsdl:input>
    
                <wsdl:output>
    
                    <soap:body use='encoded' 
    
                        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' 
    
                        namespace='urn:testNS'/>
    
                </wsdl:output>
    
            </wsdl:operation>
    
        </wsdl:binding>
    
     
    

    For document/literal, you would change it to:

    
    <wsdl:binding name='testBinding' 
    
              type='tns:testInterface'>
    
            <soap:binding 
    
                  transport='http://schemas.xmlsoap.org/soap/http'
     
                  style='document'/>
    
            <wsdl:operation name='Test'>
    
                <soap:operation 
    
                   style='document' 
    
                   soapAction='urn:Test'/>
    
                <wsdl:input>
    
                    <soap:body use='literal'/>
    
                </wsdl:input>
    
                <wsdl:output>
    
                    <soap:body use='literal'/>
    
                </wsdl:output>
    
            </wsdl:operation>
    
        </wsdl:binding>
    
    

    This was first published in October 2004

  • There are Comments. Add yours.

     
    TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

    REGISTER or login:

    Forgot Password?
    By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
    Sort by: OldestNewest

    Forgot Password?

    No problem! Submit your e-mail address below. We'll send you an email containing your password.

    Your password has been sent to: