473,806 Members | 2,795 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
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 1286
kenobewan
4,871 Recognized Expert Specialist
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
NightHawk
2 New Member
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
5390
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 2004/06/25 13:17:56 snichol Exp $. I am running PHP version 4.2.2 on RedHat 9.0 I presume I need to unallocated something other than the soapclient, but I'm nor sure what. This is the code that is called in the loop and the error message...
3
3580
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 understand the module 'email' and the functions described there to parse email but seems difficult. Can anyone help me in locating some pointers or snippets on this issue.
0
385
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 misunderstood by the framework. Basically, these are the headers received from the client (I used a packet sniffer to know exactly what we received from him before the framework modifies it):
0
966
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 (VB.NET): ----------- Dim Connector Dim Serializer Dim Reader 'On Error GoTo cleanUp
1
18214
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 is serialized correctly, and the server returns a response (I've captured the response and it's correct!) but when the .NET deserialize this response, it throws the exception "System.InvalidOperationException: There is an error in XML
0
1180
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 can't access the object, though the SOAP response looks correct. Here the received SOAP message : Response:
2
1466
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 someone could help. This is the code for the method that I call <WebMethod()Public Function GetZipCodes(ByVal iZipCode As Integer, ByVal iMiles As Integer) As String
5
4311
by: randy | last post by:
Can some point me to a good example of parsing XML using C# 2.0? Thanks
1
1610
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 service, but the SOAP-Call returns a complex type which is not handled correctly. Invoke() throws an exception stating that an object of type system.String can not be assigned to type RetDataType. Debugging shows
0
10623
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10111
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9192
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5683
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4330
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3852
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.