473,385 Members | 1,927 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,385 software developers and data experts.

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.XmlNode[] to an object of
type ConsoleApplication1.com.hilton.crmdev.SummaryType.

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::Constants::DO_NOT_USE_CHARSET = 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="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">

<types>

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

<xsd:complexType name="SummaryType">
<xsd:all>
<xsd:element name="ID" type="xsd:int"
minOccurs="1" />
<xsd:element name="LastName" type="xsd:string"
minOccurs="1" />
<xsd:element name="FirstName" type="xsd:string"
minOccurs="1" />
<xsd:element name="MiddleInit" type="xsd:string"
minOccurs="1" />
<xsd:element name="Title" type="xsd:string"
minOccurs="1" />
</xsd:all>
</xsd:complexType>

</xsd:schema>

</types>

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

<message name="DetailResponse">
<part name="return" type="tns:SummaryType" />
</message>

<portType name="TestDetailPort">
<operation name="Detail">
<input message="tns:DetailRequest"/>
<output message="tns:DetailResponse"/>
</operation>
</portType>

<binding name="TestDetailBinding" type="tns:TestDetailPort">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Detail">
<soap:operation 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="TestDetailService">
<port name="TestDetailPort" binding="tns:TestDetailBinding">
<soap:address location="http://crmdev.hilton.com: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:encodingStyle="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:DetailResponse xmlns:namesp1="urn:Test">
<namesp2:SummaryType xmlns:namesp2="urn:Test"
xsi:type="namesp3:SOAPStruct">
<FirstName xsi:type="xsd:string">Peter</FirstName>
<Title xsi:type="xsd:string">Mr.</Title>
<ID xsi:type="xsd:int">60441557</ID>
<MiddleInit xsi:type="xsd:string">F</MiddleInit>
<LastName xsi:type="xsd:string">Conrey</LastName>
</namesp2:SummaryType>
</namesp1:DetailResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
################################################
### The C# client
using System;
using System.Xml;
using System.Collections;

namespace ConsoleApplication1
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
com.hilton.crmdev.TestDetailService ds = new
com.hilton.crmdev.TestDetailService();
com.hilton.crmdev.SummaryType sumType = ds.Detail(60441557);
Console.WriteLine( "got it" );
Console.WriteLine( "{0} {1} {2} {3}",
sumType.Title,
sumType.FirstName,
sumType.MiddleInit,
sumType.LastName );
Console.ReadLine();
}
}
}
################################################## #####
### The auto-generated C# proxy class
namespace ConsoleApplication1.com.hilton.crmdev {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;
/// <remarks/>
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Web.Services.WebServiceBindingAttribute(Nam e="TestDetailBinding",
Namespace="urn:Test")]
public class TestDetailService :
System.Web.Services.Protocols.SoapHttpClientProtoc ol {

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

/// <remarks/>
[System.Web.Services.Protocols.SoapRpcMethodAttribu te("urn:Test#Detail",
RequestNamespace="urn:Test", ResponseNamespace="urn:Test")]
[return: System.Xml.Serialization.SoapElementAttribute("ret urn")]
public SummaryType Detail(int guest_id) {
object[] results = this.Invoke("Detail", new object[]
{guest_id});
return ((SummaryType)(results[0]));
}

/// <remarks/>
public System.IAsyncResult BeginDetail(int guest_id,
System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("Detail", new object[] {guest_id},
callback, asyncState);
}

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

/// <remarks/>
[System.Xml.Serialization.SoapTypeAttribute("Summar yType",
"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 2289

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

Similar topics

9
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...
1
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...
16
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...
6
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...
0
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...
102
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...
4
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...
1
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...
2
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.