Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 25th, 2006, 3:46 PM   #1
allenmpcx
Newbie
 
Join Date: Mar 2006
Posts: 1
Rep Power: 0 allenmpcx is on a distinguished road
Question perl, SOAP and C#

Alright, I have the following perl code:

sub getComplexObj
{
my $_count = 12
my $mike = {
'Count'=> SOAP::Data->new( name => 'Count', value => $_count, type => 'xsd:int' )->attr({ 'xmlns' => $MC_XMLNS }),
'test' => SOAP::Data->new( name => 'test', value => 'test string', type =>'xsd:string' )->attr({ 'xmlns'=> $MC_XMLNS })};

my $foo = SOAP::Data->new(
name => 'return',
value =>bless{ $self ,('compObj')->attr({ 'xsi:type' => typens:'compObj' })}
)->attr({ 'xmlns' => $MC_XMLNS });

return $foo;
}

I have a WSDL file and I use that to automatically generate a C# file that uses a SOAP proxy to call this function. When I run my code, I get the following error from .NET:

"Failed to access class (CS3:OAP::ComplexObject): syntax error at CS3/SOAP/ComplexObject.pm line 13, near \"typens:\"\nCompilation failed in require at (eval 201) line 3.\n"

When I change the $foo object to:
my $foo = SOAP::Data->name('return')->value(bless{ $self ,'compObj'})->attr({ 'xmlns' => $MC_XMLNS });

I get this error from .NET:
"Cannot assign object of type System.Xml.XmlNode[] to an object of type compObj."

Just for reference, my C# file looks like this:

///
///
/// foo
///
[System.Web.Services.WebServiceBinding(Name="ComplexObjectPort", Namespace="http://VALIDHTTP")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public class ComplexObj : System.Web.Services.Protocols.SoapHttpClientProtocol {

public ComplexObj() {
this.Url = "http://VALIDHTTP/co.pcgi";
}

[System.Web.Services.Protocols.SoapRpcMethodAttribute("http://VALIDHTTP#getComplexObj", RequestNamespace="http://VALIDHTTP", ResponseNamespace="http://VALIDHTTP")]
[return: System.Xml.Serialization.SoapElement("return")]
public compObj getComplexObj() {
object[] results = this.Invoke("getComplexObj", new object[]);
return ((compObj)(results[0]));
}

public System.IAsyncResult BegingetComplexObj(System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("getComplexObj", new object[], callback, asyncState);
}

public compObj EndgetComplexObj(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((compObj)(results[0]));
}
}

///
[System.Xml.Serialization.SoapType(Namespace="http://VALID HTTP")]
public class compObj {

///
public int Count;

///
public string test;
}

Then in a main file I have:

try
{
ComplexObject co = new ComplexObject();
compObj comp = co.getComplexObj();
}
catch( Exception e )
{
richTextBox1.Text+=e.Message + "\n" + e.StackTrace;
}

My ultimate goal is simply to call a function from perl that returns a complex object. ANY help would be greatly appreciated.

Last edited by allenmpcx; Mar 25th, 2006 at 4:04 PM.
allenmpcx is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:15 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC