当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - 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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: