G
googlegroups
Hi,
My company has developed a series of SOAP services using SOAP::Lite on
Linux. We've successfully had other Perl, PHP, Ruby and Java clients
access the services, but no luck with .NET yet. I've created a simple
service to try and identify the problem, which hopefully somebody will
be able to help with. I think it's a problem with how the server is
serializing the data, or more specifically, how .NET expects it to be
serialized...
I consume the following document literal (wrapped) WSDL file:
http://alpha.wirespring.net/web_services/Endpoints/SOAP/Demo?WSDL,
generate a dll using wsdl.exe and csc. You can re-generate it if you
like, but the method call for return_chars() looks like this:
public string
return_chars([System.Xml.Serialization.XmlElementAttribute(
"return_chars",
Namespace="urn:Endpoints/SOAP/Demo"
)] return_chars return_chars1) {
object[] results = this.Invoke("return_chars", new object[] {
return_chars1});
return ((string)(results[0]));
}
We then compile a C# client against Demo.dll (the Security section is
optional, since we've disabled the authentication to try and work this
bug out):
using System;
using System.Diagnostics;
using System.Net;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
class Example1 {
public static void Main(string[] args) {
// Set parameters
return_chars x = new return_chars();
x.input_string = "NET SOAP test string";
x.second_string = "";
//Security auth_info = new Security();
//auth_info.Account = "ACCOUNTNAME";
//auth_info.Username = "username";
//auth_info.Password = "password";
Demo myDemo = new Demo();
//myDemo.SecurityValue = auth_info;
Console.WriteLine("Got return value: " +
myDemo.return_chars(x));
}
}
When we execute the client, it hits the server, which returns back
valid-looking XML, however myDemo.return_chars(x) is null. I used .NET
Webservice Studio to examine the response content. This is what the
server is sending back:
ResponseCode: 200 (OK)
Pragma:no-cache
SOAPAction:"Endpoints/SOAP/Demo#return_chars"
X-Cache:MISS from alpha.wirespring.net
Transfer-Encoding:chunked
Cache-Control:no-cache
Content-Type:text/xml
Date:Fri, 08 Dec 2006 18:58:43 GMT
Expires:Fri, 08 Dec 2006 18:58:43 GMT
Server:Apache/1.3.34 (Unix) mod_perl/1.29
<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<return_charsResponse
soap:encodingStyle="http://xml.apache.org/xml-soap/literalxml">
<s-gensym18 xsi:type="xsd:string">N.E.T. .S.O.A.P .t.e.s.t.
..s.t.r.i.n.g</s-gensym18>
</return_charsResponse>
</soap:Body>
</soap:Envelope>
The visual tool in .NET WebService Studio also indicates that the
result string is null. Oddly, though, when I use the Java-based
StrikeIron Web Service Analyzer, I get the exact same return content,
but it does correctly grab the return string.
At this point we're about out of ideas, so I'd appreciate any insight
that you .NET experts may have!
My company has developed a series of SOAP services using SOAP::Lite on
Linux. We've successfully had other Perl, PHP, Ruby and Java clients
access the services, but no luck with .NET yet. I've created a simple
service to try and identify the problem, which hopefully somebody will
be able to help with. I think it's a problem with how the server is
serializing the data, or more specifically, how .NET expects it to be
serialized...
I consume the following document literal (wrapped) WSDL file:
http://alpha.wirespring.net/web_services/Endpoints/SOAP/Demo?WSDL,
generate a dll using wsdl.exe and csc. You can re-generate it if you
like, but the method call for return_chars() looks like this:
public string
return_chars([System.Xml.Serialization.XmlElementAttribute(
"return_chars",
Namespace="urn:Endpoints/SOAP/Demo"
)] return_chars return_chars1) {
object[] results = this.Invoke("return_chars", new object[] {
return_chars1});
return ((string)(results[0]));
}
We then compile a C# client against Demo.dll (the Security section is
optional, since we've disabled the authentication to try and work this
bug out):
using System;
using System.Diagnostics;
using System.Net;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
class Example1 {
public static void Main(string[] args) {
// Set parameters
return_chars x = new return_chars();
x.input_string = "NET SOAP test string";
x.second_string = "";
//Security auth_info = new Security();
//auth_info.Account = "ACCOUNTNAME";
//auth_info.Username = "username";
//auth_info.Password = "password";
Demo myDemo = new Demo();
//myDemo.SecurityValue = auth_info;
Console.WriteLine("Got return value: " +
myDemo.return_chars(x));
}
}
When we execute the client, it hits the server, which returns back
valid-looking XML, however myDemo.return_chars(x) is null. I used .NET
Webservice Studio to examine the response content. This is what the
server is sending back:
ResponseCode: 200 (OK)
Pragma:no-cache
SOAPAction:"Endpoints/SOAP/Demo#return_chars"
X-Cache:MISS from alpha.wirespring.net
Transfer-Encoding:chunked
Cache-Control:no-cache
Content-Type:text/xml
Date:Fri, 08 Dec 2006 18:58:43 GMT
Expires:Fri, 08 Dec 2006 18:58:43 GMT
Server:Apache/1.3.34 (Unix) mod_perl/1.29
<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<return_charsResponse
soap:encodingStyle="http://xml.apache.org/xml-soap/literalxml">
<s-gensym18 xsi:type="xsd:string">N.E.T. .S.O.A.P .t.e.s.t.
..s.t.r.i.n.g</s-gensym18>
</return_charsResponse>
</soap:Body>
</soap:Envelope>
The visual tool in .NET WebService Studio also indicates that the
result string is null. Oddly, though, when I use the Java-based
StrikeIron Web Service Analyzer, I get the exact same return content,
but it does correctly grab the return string.
At this point we're about out of ideas, so I'd appreciate any insight
that you .NET experts may have!