简体   繁体   中英

How to customize the Soap message?

I have an auto generated code that is generated from the WSDL. I want to send an additional parameter in the Soap Body. The request is sent such way, but i want to implement the <position> and <positionvar> , the rest of the code is implemented (i want to send even position and positionvar in the request which is not implemented.

<svc:getSomething>
 <module>
     ...........
     ..............
     .................
     ..................
 <position>a</position>
 <positionvar>b</positionvar>
 .............
 </module>

Here i want to add <position> and <positionvar> .

i am using VS 2010 C# win forms.

Are you asking you want to modify the WSDL schema so that you could add another element inside the Soap body? You need to add the elements like so in your WSDL schema:

<s:element name="getSomething">         
   <s:complexType>      
     <s:sequence>
            ... 
            <s:element minOccurs="0" maxOccurs="1" name="position" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="positionvar" type="s:string"/>
     </s:sequence>  
   </s:complexType>     
</s:element>    

Then re-add the WSDL for visualstudio to parse it.

The above is just an example that I derived from your SOAP body. Adjust it as necessary for your own WSDL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM