472,371 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,371 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 2232

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: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

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.