473,725 Members | 1,971 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem using Perl web service with C# client.

I have a perl web service (using SOAP::Lite) with a method called
"Detail" that returns a strucure (hash reference to be exact). It
works fine when consumed by a Perl client, but when I try to consume
it with a C# application, I get the following runtime error from C#:

Cannot assign object of type System.Xml.XmlN ode[] to an object of
type ConsoleApplicat ion1.com.hilton .crmdev.Summary Type.

Below is the Perl code that generates the hash, the.wsdl file, the
returned SOAP message and the C# client code. Sorry for the long post.
Any help would be greatly appreciated.

############### ############### ############### ##########
### The Perl
package Test;

use strict;
use SOAP::Lite;

$SOAP::Constant s::DO_NOT_USE_C HARSET = 1;

sub Detail
{
my $class = shift();
my $id = shift();
my $return = {
ID => $id,
LastName => 'Conrey',
FirstName => 'Peter',
MiddleInit => 'F',
Title => 'Mr.'
};
return SOAP::Data->name( 'SummaryType' )
->uri( "urn:Test" )
->value( $return );
}

############### ############### ##############
### The WSDL file
<?xml version="1.0"?>

<definitions name="Test"
targetNamespace ="urn:Test"
xmlns:tns="urn: Test"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:soap="htt p://schemas.xmlsoap .org/wsdl/soap/"
xmlns:enc="http ://schemas.xmlsoap .org/soap/encoding/"
xmlns:wsdl="htt p://schemas.xmlsoap .org/wsdl/"
xmlns="http://schemas.xmlsoap .org/wsdl/">

<types>

<xsd:schema targetNamespace ="urn:Test">

<xsd:complexTyp e name="SummaryTy pe">
<xsd:all>
<xsd:element name="ID" type="xsd:int"
minOccurs="1" />
<xsd:element name="LastName" type="xsd:strin g"
minOccurs="1" />
<xsd:element name="FirstName " type="xsd:strin g"
minOccurs="1" />
<xsd:element name="MiddleIni t" type="xsd:strin g"
minOccurs="1" />
<xsd:element name="Title" type="xsd:strin g"
minOccurs="1" />
</xsd:all>
</xsd:complexType >

</xsd:schema>

</types>

<message name="DetailReq uest">
<part name="id" type="xsd:int"/>
</message>

<message name="DetailRes ponse">
<part name="return" type="tns:Summa ryType" />
</message>

<portType name="TestDetai lPort">
<operation name="Detail">
<input message="tns:De tailRequest"/>
<output message="tns:De tailResponse"/>
</operation>
</portType>

<binding name="TestDetai lBinding" type="tns:TestD etailPort">
<soap:binding style="rpc"
transport="http ://schemas.xmlsoap .org/soap/http"/>
<operation name="Detail">
<soap:operati on soapAction="urn :Test#Detail"/>
<input>
<soap:body use="encoded" namespace="urn: Test"
encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn: Test"
encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/"/>
</output>
</operation>
</binding>

<service name="TestDetai lService">
<port name="TestDetai lPort" binding="tns:Te stDetailBinding ">
<soap:address location="http://crmdev.hilton.c om:7994/webservices/test/Test.pl"/>
</port>
</service>

</definitions>
############### ############### ############### ###
### The SOAP Response message
<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:namesp3=" http://xml.apache.org/xml-soap"
xmlns:SOAP-ENC="http://schemas.xmlsoap .org/soap/encoding/"
SOAP-ENV:encodingSty le="http://schemas.xmlsoap .org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap .org/soap/envelope/"
xmlns:xsi="http ://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<namesp1:Detail Response xmlns:namesp1=" urn:Test">
<namesp2:Summar yType xmlns:namesp2=" urn:Test"
xsi:type="names p3:SOAPStruct">
<FirstName xsi:type="xsd:s tring">Peter</FirstName>
<Title xsi:type="xsd:s tring">Mr.</Title>
<ID xsi:type="xsd:i nt">60441557</ID>
<MiddleInit xsi:type="xsd:s tring">F</MiddleInit>
<LastName xsi:type="xsd:s tring">Conrey</LastName>
</namesp2:Summary Type>
</namesp1:DetailR esponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
############### ############### ############### ###
### The C# client
using System;
using System.Xml;
using System.Collecti ons;

namespace ConsoleApplicat ion1
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
com.hilton.crmd ev.TestDetailSe rvice ds = new
com.hilton.crmd ev.TestDetailSe rvice();
com.hilton.crmd ev.SummaryType sumType = ds.Detail(60441 557);
Console.WriteLi ne( "got it" );
Console.WriteLi ne( "{0} {1} {2} {3}",
sumType.Title,
sumType.FirstNa me,
sumType.MiddleI nit,
sumType.LastNam e );
Console.ReadLin e();
}
}
}
############### ############### ############### ##########
### The auto-generated C# proxy class
namespace ConsoleApplicat ion1.com.hilton .crmdev {
using System.Diagnost ics;
using System.Xml.Seri alization;
using System;
using System.Web.Serv ices.Protocols;
using System.Componen tModel;
using System.Web.Serv ices;
/// <remarks/>
[System.Diagnost ics.DebuggerSte pThroughAttribu te()]
[System.Componen tModel.Designer CategoryAttribu te("code")]
[System.Web.Serv ices.WebService BindingAttribut e(Name="TestDet ailBinding",
Namespace="urn: Test")]
public class TestDetailServi ce :
System.Web.Serv ices.Protocols. SoapHttpClientP rotocol {

/// <remarks/>
public TestDetailServi ce() {
this.Url =
"http://crmdev.hilton.c om:7994/webservices/test/Test.pl";
}

/// <remarks/>
[System.Web.Serv ices.Protocols. SoapRpcMethodAt tribute("urn:Te st#Detail",
RequestNamespac e="urn:Test", ResponseNamespa ce="urn:Test")]
[return: System.Xml.Seri alization.SoapE lementAttribute ("return")]
public SummaryType Detail(int guest_id) {
object[] results = this.Invoke("De tail", new object[]
{guest_id});
return ((SummaryType)( results[0]));
}

/// <remarks/>
public System.IAsyncRe sult BeginDetail(int guest_id,
System.AsyncCal lback callback, object asyncState) {
return this.BeginInvok e("Detail", new object[] {guest_id},
callback, asyncState);
}

/// <remarks/>
public SummaryType EndDetail(Syste m.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke( asyncResult);
return ((SummaryType)( results[0]));
}
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("S ummaryType",
"urn:Test")]
public class SummaryType {

/// <remarks/>
public int GuestID;

/// <remarks/>
public string LastName;

/// <remarks/>
public string FirstName;

/// <remarks/>
public string MiddleInit;

/// <remarks/>
public string Title;
}
}
Nov 21 '05 #1
0 2309

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2251
by: Sudesh Sawant | last post by:
Hello, We have an application which communicates using remoting. There is a server which is a Windows Service. The server exposes an object which is a singleton. The client is a Web Application which makes calls to the service. We are using tcp channel which is using binaryformatter by default. The problem is that after a certain number of remoting calls the calls dont get through to the server. The client application makes the call and...
1
6577
by: JTrigger | last post by:
I need to call a .Net web service that takes an array or object as a parameter from a PERL client. I have been trying to use the PERL SOAP::Lite package to do this without success. I can call one that takes a simple type, such as int or string, but not an array or object. Please help!!! My code that I have written to call the web service and the SOAP packets that get sent and received are below. It seems like no matter what I do I...
16
4921
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by Microsoft must be installed on their servers. Now german Umlaute (ä, ü, ö) and quotes are returned incorrectly in SOAP fault responses. This can be easily verified: Implement the following in a web service method (just raises a SOAPException with a...
6
1909
by: Picho | last post by:
Hi all. I have a webservice and a windows app. both of them reference the same class library called WebServiceTest.Core that defines a class called Class1. the webservice exposes a method that looks like this: public WebServiceTest.Core.Class1 GetClass1()
0
1451
by: Zean Smith | last post by:
I am trying to get my C# client to connect to a 3rd Perl Web Service (SOAP Lite), this is the code that fails ...... object results = this.Invoke("getGrossData", new object {week} ); return ((string)results); ....... The problem: It always return a NULL in results. Why is that??
102
6800
by: hug | last post by:
www.webmaster, was suggested that this ng could be a better place.] I've updated my test server to handle if-modified-since. I've noticed that the (old copies I run of) IE and Netscape seem never to send if-modified-since. But the strange thing is that Opera sends if-modified-since but when I reply with "HTTP/1.0 304 Not Modified" it is not refreshing the screen from its cache, it is leaving the screen blank.
4
2956
by: Patricia Mindanao | last post by:
I want to call cgi perl scripts on my web hosters server from my HTML web pages (on the the web hosters server too). It occurs sometimes (especially during development phase) that these cgi-perl scripts didn't work like intended. They crash because e.g. - syntax errors - wrong or changing pathes - unexpected user input - ...
1
8285
by: parimalb | last post by:
Hi All, I want to pass an array argument to the java webservice from perl client using SOAP::LITE package. Please let me know if anyone knows about this. The web method declaration in java is like this publishSimpleMetric(Arraylist<String> appinfo,Arraylist<String> metricinfo,String seperator); Now i tried to call the web service from perl client as follows ...
2
1934
by: =?Utf-8?B?aGVsZmk=?= | last post by:
Hi all, I have replied with my own questions to an older post entry but after a while I thought it's better to start a new thread based on the previous one. Perhaps with the new thread I will catch more eyes and find someone who had the same problem and solved it or has more information about it. This is a summary of my problem:
0
9256
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...
1
9168
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8091
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
6701
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
6010
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4780
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3218
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
2632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2154
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.