Click here to Skip to main content
15,665,718 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

i have created a simple web method("Open") and the SOAP is looking like below

XML
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">urn:IEhelplineService/Open</Action>
  </s:Header>
  <s:Body>
    <Open>
      <attachment>
        <name>c:1.jpg</name>
        <type>jpg</type>
        <encodedstring>fdsfdsfdsf3434324$#@$#@$</encodedstring>
      </attachment>
    </Open>
  </s:Body>
</s:Envelope>


Open is the web method with operationcontract attribute and attachment is its parameter. Attachment is the class with datacontract attribute. Currently name,type and encodedstring are parameters with datamember attributes.

I want it to look like below.

XML
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">urn:IEhelplineService/Open</Action>
  </s:Header>
  <s:Body>
    <Open>
      <attachment name="c:1.jpg" type="jpg">fdsfdsfdsf3434324$#@$#@$</attachment>
    </Open>
  </s:Body>
</s:Envelope>



Difference is the name,type and encoded strings are attribute nodes in the xml than childnodes. how do i do it?
Posted
Comments
Sergey Alexandrovich Kryukov 13-Jun-13 12:51pm    
I doubt you can control it. Please see my recent answer:
http://www.codeproject.com/Answers/605928/d4p1plusinpluseachplusnodeplusinpluswsdl#answer1

This answer is unrelated to your problem (that's why I'm not posting a formal answer), but it can give you some ideas.

I would like to add: I don't really like SOAP, but it really works, thoroughly tested, etc. It's not really designed for minimal stream sizes or perfect human readability...

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900