Q

Using MS SOAP toolkit to generate Web services, part 2

This Content Component encountered an error

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?


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

    Dig deeper on Simple Object Access Protocol (SOAP)

    Pro+

    Features

    Enjoy the benefits of Pro+ membership, learn more and join.

    Have a question for an expert?

    Please add a title for your question

    Get answers from a TechTarget expert on whatever's puzzling you.

    You will be able to add details on the next page.

    0 comments

    Oldest 

    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:

    -ADS BY GOOGLE

    SearchSoftwareQuality

    SearchCloudApplications

    SearchAWS

    TheServerSide

    SearchWinDevelopment

    Close