473,325 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Trouble parsing an object after it is received from a soap message.

I am using C# in VS2005 .Net, with a service which passes data to a proxy using a soap message. If all of the instance variables are strong typed, I have no problem, but I need to pass an instance variable which is held as an object. When I get the object in the proxy, it is an XmlNode[] with 2 elementsXmlNode[0] is an XmlAttribute, and XmlNode[1] is an XmlText. The XmlAttribute contains the correct information about the data type, and the XmlText contains the correct data.

I am looking for a way to have this return the correct data type with the data, instead of getting an XmlNode[].

I used test code similar to the following:

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Xml.Serialization;
  5.  
  6. namespace MewtV2.SystemFrameworks.Data.Device
  7. {
  8.     [Serializable()]
  9.     [System.ComponentModel.DesignerCategoryAttribute( "code" )]
  10.     [System.Diagnostics.DebuggerStepThrough()]
  11.     [System.ComponentModel.ToolboxItem( true )]
  12.     [XmlInclude( typeof( TestObject ) )]
  13.     public class TestObject
  14.     {
  15.         public object Test = 69;
  16.  
  17.         public TestObject (int arg)
  18.         {
  19.             Test = arg;
  20.         }
  21.     }
  22. }
  23.  
  24.  
  25. In the service, I did the following:
  26. TestObject ob = new TestObject(new TestData(72, "test string"));
  27. SoapEnvelope replyEnvelope = MakeSoapEnvelope( DeviceServiceLiterals.DataReceivedResponseAction );
  28. replyEnvelope.SetBodyObject( data );
  29. replyEnvelope.Context.Addressing.To = new To( filter.Listener() );
  30. SoapSender soapSender = new SoapSender( filter.Listener() );
  31. soapSender.Send( replyEnvelope );
  32. In the proxy, I have the following:
  33. TestObject cmd = (TestObject)env.GetBodyObject(typeof(TestObject));
  34. object ob = cmd.Test;
  35.  
  36. At this point, ob is an XmlNode[] instead of an integer.
  37.  
Jan 18 '07 #1
2 1267
kenobewan
4,871 Expert 4TB
I do not trust passing any complex objects via SOAP. If you have to, then ensure that you use the smallest and most optimal packets possible. If there is a way send in a binary format instead of a large plain text xml packet, then this would be the way to go...
Jan 19 '07 #2
I do not trust passing any complex objects via SOAP. If you have to, then ensure that you use the smallest and most optimal packets possible. If there is a way send in a binary format instead of a large plain text xml packet, then this would be the way to go...
In this case, I have to pass a complex object, and I don't have the option of using a binary format due to the software specs.
Jan 19 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Mark C | last post by:
I have a memory allocation problem in PHP using NuSOAP and the built in XML parser. The code below is called in a loop and executed about 1900 times before it failed. I am using nusoap.php,v 1.76...
3
by: dont bother | last post by:
Hey, I have been trying to parse emails: But I could not find any examples or snippets of parsing emails in python from the documentation. Google did not help me much too. I am trying to...
0
by: Karl | last post by:
Hi everyone, We developped a WebService with Visual Studio .Net and we faced an authentication problem with a java client. My assumption is that this is because cookies passed from client are...
0
by: T.Horton | last post by:
Currently in a VB6 application we are using SOAP to send an XML file to another application. I have not been successfull in finding a way to convert the code below to something similar in ASP.NET...
1
by: Marc | last post by:
Hi! I'm working with a C# client that calls a php web service. I've created a wrapper to call the service using .NET wsdl tool (adding a web reference). The call to the server works fine, it...
0
by: Jacques Lebastard | last post by:
Hi there, I'm new to the SOAP PHP5 extension. It works fine for web service methods that returns basic types (string,int,...). However, for methods that return an object of a class I defined, I...
2
by: irishdudeinusa | last post by:
Hello Everyone, I have been working a webservice where I can use it in other applications that I am working on. However, I am running into a problem with the data returned and I was wondering if...
5
by: randy | last post by:
Can some point me to a good example of parsing XML using C# 2.0? Thanks
1
by: sebastian.mattar | last post by:
HI there! I am trying to consume a web service implemented in Perl (SOAP::Lite) using VS Express 2008. I already implemented a client in java without problems. I succeeded in calling the web...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.