Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Add Custom Nodes to SOAP envelope - .NET 2.0 C#

From: "John Saunders [MVP]" <john.saunders at trizetto.com>
To: NULL
Date: 7/5/2007 8:33:00 PM


"Chris" <Chris@d...> wrote in message 
news:1F861D1B-26BF-400F-AC29-AA31CE9587B6@m......
>I need to add an Element to the Body of My SOAP Header.
>
> I have a routine in a .NET 2.0 web service (C#) like so:
>
>
> ***Being Code Snippet*****
>
> [WebMethod]
> public string CreatePurchaseOrder(string ProcessPurchaseOrderBOD)
> {
>
>      //Do my Thing
>
>
>      return MyString; (String is an XML string)
> }
>
> ***End Code Snippet****
>
>
> This method routines a string in this SOAP Envelope:
>
> ***** Start Envelope **************
>
> <?xml version="1.0" encoding="utf-8"?>
> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
> <soap12:Header>
> </soap12:Header>
> <soap12:Body>
> <CreatePurchaseOrderResponse
> xmlns="http://www.aftermarket.org/InternetPartsOrder">
> <CreatePurchaseOrderResult>MyString</CreatePurchaseOrderResult>
> </CreatePurchaseOrderResponse>
> </soap12:Body>
> </soap12:Envelope>
>
> *********** End Envelope **************
>
> I need to add a custom node called <ConfirmBOD> as a Childe node of the
> <CreatePurchaseOrderResult> node in  the SOAP Body. Any help would be 
> greatly
> appreciated.

Sorry to take so long to respond to this.

If I understand you correctly, you have a WebMethod that returns a string 
with XML in it. Question 1 is why not return the XML as an XmlElement 
instead?  I've seen quite a bit of code get into trouble by trying to treat 
XML as "just a string".

Secondly, if you want your WebMethod to return both your "XML string" and a 
custom node, then why not change the WebMethod signature? You can have it 
return string, but take an "out" parameter of type XmlElement, which can 
return your child node.
-- 
John Saunders [MVP]



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent