PC Review


Reply
Thread Tools Rate Thread

Building a SOAP Message (in Compact Framework) [REPLYING FROM microsoft.public.dotnet.framework]

 
 
news.microsoft.com
Guest
Posts: n/a
 
      16th Mar 2004
I have exactly the same problem but instead the solution is directed to
compact framework.

I decided to use DOM. Using the XmlDocument class I created all the nodes
(envelope, body, etc) and sent it to a stream with the XmlDocument.Save
method. However, an exception was returned saying that it "Cannot use a
prefix with an empty namespace".

I decided to look a bit better and I came upon the InnerXml property of the
current object (XmlDocument). It had the following value (since InnerXml is
a string property it is full of escape characters, don't mind those):

<?xml version=\"1.0\" encoding=\"utf-8\"?>
<s:Envelope encodingStyle=\"http://www.w3.org/2003/05/soap-encoding\"
xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\">
<s:Body>
<u:SetTarget xmlns:u=\"urn:schemas-upnp-org:service:SwitchPower:1\">
<newTargetValue>1</newTargetValue>
</u:SetTarget>
</s:Body>
</s:Envelope>

What seems to be the problem? Is it the s:Body element? I already read
documents about XML namespaces and it seems fine to me. There is no
namespace since it inherits it from the above node (s:Envelope).
Actually I think that namespace was removed by XmlDocument since I created
the Body node with a namespace (the same as the Envelope's).

Cheers!
Pedro

>You can build soap messages using the .NET XML classes, which is a more
>attractive method to build it, as you will be certain to have the correct
>formatting when you are finished. Create the SOAP message as an XML doc and
>add nodes to build the entire envelope hierarchy.
>
>--
>Gregory A. Beamer
>MVP; MCP: +I, SE, SD, DBA
>
>***************************************************************
>Think outside the box!
>***************************************************************
>"Christopher D. Wiederspan" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> I have a simple project in which I need to build a Soap message "by

hand".
>> Essentially I'm using a System.Net.HttpWebRequest to post data to a
>> webservice. Everything is working well, but I'm currently using a
>> StringBuilder to build the Content (the Soap message) portion of the

post.
>> I've got to believe that there is a better way to accomplish this. The
>> message that I need to build is something like this:
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>> <soap:Body>
>> <Execute xmlns="http://tempuri.org/">
>> <message>string</message>
>> </Execute>
>> </soap:Body>
>> </soap:Envelope>
>>
>> Is my best bet to build an XmlDocument object that happens to contain the
>> Soap namespace, or is there some sort of object somewhere else in the
>> framework that makes building the Soap message easier?
>>
>> Please let me know if you have any ideas.
>>
>> Thanks,
>> Chris
>>
>>



 
Reply With Quote
 
 
 
 
Ronnie Yates [MS]
Guest
Posts: n/a
 
      2nd Apr 2004
Can you psot the code you are using to build the XmlDocument?

.NET Compact Framework FAQ:
http://msdn.microsoft.com/mobility/p.../FAQ/default.a
spx
.NET Compact Framework KickStart:
http://www.amazon.com/exec/obidos/tg...070652954//ref
=sr_8_xs_ap_i0_xgl14/103-0627618-0577446?v=glance&s=books&n=507846

This posting is provided "AS IS" with no warranties, and confers no rights.


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
,microsoft.public.vsnet.ide,microsoft.public.dotnet.framework.windowsforms.controls,microsoft.public.dotnet.languages.csharp Frnak McKenney Microsoft C# .NET 0 21st Jul 2005 01:48 AM
Finding/Listing usb/bluetooth/... serial-ports with System.Management.dll[reposted from microsoft.public.dotnet.framework.sdk, microsoft.public.dotnet.framework.wmi] Helge Jensen Microsoft Dot NET 0 2nd Jul 2005 07:34 AM
Finding/Listing usb/bluetooth/... serial-ports with System.Management.dll[reposted from microsoft.public.dotnet.framework.sdk, microsoft.public.dotnet.framework.wmi] Helge Jensen Microsoft C# .NET 0 2nd Jul 2005 07:34 AM
Building a SOAP Message (in Compact Framework) [REPLYING FROM microsoft.public.dotnet.framework] news.microsoft.com Microsoft Dot NET Framework 0 16th Mar 2004 04:54 PM
microsoft.public.dotnet.languages.vb,microsoft.public.windowsxp.print_fax,microsoft.public.dotnet.framework.aspnet SpamProof Microsoft ASP .NET 0 21st Oct 2003 01:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:52 AM.