Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Add Custom Nodes to SOAP envelope - .NET 2.0 C# [Thread Next] Re: Add Custom Nodes to SOAP envelope - .NET 2.0 C#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] | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
