You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Vidyanand Murunikkara <Vi...@infravio.com> on 2002/04/04 01:11:29 UTC

RE: Problems calling Axis service from .NET C# client

Peter

I have seen this happen in case of dotnet .. and the reason it fails is
because dotnet expects the XML corresponding to the object that it
deserializes to have no prefixes .. 

if all the prefixes are stripped off for the elements in the following
part I guess it shld work.

 <ns1:loginResponse
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://service.xmlinterface.xcut.clareos.com">
      <loginResult href="#id0" />
    </ns1:loginResponse>
    <multiRef id="id0" SOAP-ENC:root="0" xsi:type="ns2:XcutResponse"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://service.xmlinterface.xcut.clareos.com">
      <ns2:ReturnCode xsi:type="xsd:int">0</ns2:ReturnCode>
      <ns2:ReturnStatus xsi:type="xsd:boolean">true</ns2:ReturnStatus>
      <ns2:ReturnString xsi:type="xsd:string">Logged
in!</ns2:ReturnString>

Vidyanand.

-----Original Message-----
From: Peter A. Kozma [mailto:pkozma@clareos.com]
Sent: Friday, March 29, 2002 12:53 PM
To: axis-user@xml.apache.org
Subject: RE: Problems calling Axis service from .NET C# client


Stan,

Thanks for taking a look. I've tried proxy DLL from "wsdl.exe", adding a
web reference through .NET, and the webservice studio. While I can
generate and build the proxy in all methods named and see the SOAP
request and response, I cannot get a valid response back in .NET land
(as described in original note).

~ Peter



-----Original Message-----
From: Stan Jordan [mailto:skjordan@worldnet.att.net] 
Sent: Friday, March 29, 2002 3:46 PM
To: axis-user@xml.apache.org
Subject: Re: Problems calling Axis service from .NET C# client

Peter...
The usual way to build a C# client is:
1) Create proxy DLL from wsdl file, using this executable:
   c:\Program Files\Microsoft.NET\FrameworkSDK\Bin\wsdl.exe
2) Write your client, which uses the proxy.
Did you create your client this way?  If not, maybe you should give it a
try.

Another (better) way to create the proxy is via ".NET WebService Studio"
which you can download here:
  http://www.gotdotnet.com/team/tools/web_svc/default.aspx
Personally, I love the studio, because it:
1)  generates both proxy and client, and
2)  provides a nice GUI for entering input data to test your service.

I tried your wsdl file with .NET WebService Studio, and it seems to be
okay
(I was able to create a proxy and client).
Good luck.
Stan

----- Original Message -----
From: "Peter A. Kozma" <pk...@clareos.com>
To: <ax...@xml.apache.org>
Sent: Friday, March 29, 2002 8:57 AM
Subject: RE: Problems calling Axis service from .NET C# client


Hi Stan,

Attached is the entire wsdl file. Thanks!

I added a trace extension to the .NET method to follow the message
through the various stages... no luck so far.

~ Peter


-----Original Message-----
From: Stan Jordan [mailto:skjordan@worldnet.att.net]
Sent: Friday, March 29, 2002 10:48 AM
To: axis-user@xml.apache.org
Subject: Re: Problems calling Axis service from .NET C# client

Peter...
Send me the entire wsdl file, and I can prolly help. Or send me the
URL, if you have deployed your service to the web.
Stan
----- Original Message -----
From: Peter A. Kozma
To: axis-user@xml.apache.org
Sent: Friday, March 29, 2002 6:49 AM
Subject: Problems calling Axis service from .NET C# client

I have a web services method running on Axis (beta 1) that looks like:
XcutPlay1Response login (String id, String pw);

The return type is complex (see WSDL below). Calling from an Axis client
works fine. When invoked from .NET, I get an empty response object back
(string = null, int = 0, bool = false) and no errors. I look at the
actual SOAP messages and everything going up and down looks good (see
response message below). My service is getting invoked. Calling Axis
from .NET works with methods that do not involve complex types.

Anyone have any ideas?

Thanks.

*** start response message
Content-Type:text/xml; charset=utf-8

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SOAP-ENV:Body>
    <ns1:loginResponse
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://service.xmlinterface.xcut.clareos.com">
      <loginResult href="#id0" />
    </ns1:loginResponse>
    <multiRef id="id0" SOAP-ENC:root="0" xsi:type="ns2:XcutResponse"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://service.xmlinterface.xcut.clareos.com">
      <ns2:ReturnCode xsi:type="xsd:int">0</ns2:ReturnCode>
      <ns2:ReturnStatus xsi:type="xsd:boolean">true</ns2:ReturnStatus>
      <ns2:ReturnString xsi:type="xsd:string">Logged
in!</ns2:ReturnString>
    </multiRef>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
*** end response message

*** start WSDL
.
<types>
  <schema targetNamespace="http://service.xmlinterface.xcut.clareos.com"
xmlns="http://www.w3.org/2001/XMLSchema">
   <complexType name="XcutPlay1Response">
    <sequence>
     <element name="ReturnCode" type="xsd:int"/>
     <element name="ReturnString" nillable="true" type="xsd:string"/>
     <element name="ReturnStatus" type="xsd:boolean"/>
    </sequence>
   </complexType>
   <element name="XcutPlay1Response" nillable="true"
type="tns1:XcutPlay1Response"/>
  </schema>
 </types>
.
   <wsdl:message name="loginResponse">

      <wsdl:part name="return" type="tns1:XcutPlay1Response"/>

   </wsdl:message>
.
      <wsdl:operation name="login" parameterOrder="in0 in1">

         <wsdl:input message="intf:loginRequest"/>

         <wsdl:output message="intf:loginResponse"/>

      </wsdl:operation>
.
*** end WSDL

*** start C#
    /// <remarks/>
    [System.Web.Services.Protocols.SoapRpcMethodAttribute("",
RequestNamespace="http://service.xmlinterface.xcut.clareos.com",
ResponseNamespace="http://service.xmlinterface.xcut.clareos.com")]
    [return: System.Xml.Serialization.SoapElementAttribute("return")]
    public XcutResponse login(string in0, string in1) {
        object[] results = this.Invoke("login", new object[] {
                    in0,
                    in1});
        return ((XcutResponse)(results[0]));
    }

.

/// <remarks/>
[System.Xml.Serialization.SoapTypeAttribute("XcutResponse",
"http://service.xmlinterface.xcut.clareos.com")]
public class XcutResponse {

    /// <remarks/>
    public int ReturnCode;

    /// <remarks/>
    public string ReturnString;

    /// <remarks/>
    public bool ReturnStatus;
}

*** end C#





RE: Problems calling Axis service from .NET C# client

Posted by "Peter A. Kozma" <pk...@clareos.com>.
Hello Vidyanand,

Thanks for the info. I updated my AXIS to the 4/3 build and now the
response coming back from AXIS no longer has the prefix and it works
(see details below). So, something must have changed between builds
because I am not doing anything different today? Here is the response
message that works:

*** response message from Axis without prefix
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SOAP-ENV:Body>
    <ns1:getC4ResponseResponse
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://xmlinterface.xcut.clareos.com">
      <getC4ResponseReturn href="#id0" />
    </ns1:getC4ResponseResponse>
    <multiRef id="id0" SOAP-ENC:root="0" xsi:type="ns2:Complex4Response"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://xmlinterface.xcut.clareos.com">
      <s1 xsi:type="xsd:string">ff</s1>
      <s2 xsi:type="xsd:string">ee</s2>
      <i1 xsi:type="xsd:int">0</i1>
      <b1 xsi:type="xsd:boolean">false</b1>
    </multiRef>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
*** end response message from Axis without prefix

I am still having problems sending a complex type as a parameter from
dotnet client to Axis web service. The WSDl for this one is attached.
When I call the AXIS service using dotnet web service studio client, I
get a java.lang.NullPointerException exception. There is nothing in the
Tomcat log. Here are the request and response messages:

*** start request from dotnet
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://xmlinterface.xcut.clareos.com"
xmlns:types="http://xmlinterface.xcut.clareos.com/encodedTypes"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <tns:getC5ParamTest>
      <in0 href="#id1" />
    </tns:getC5ParamTest>
    <tns:Complex5Param id="id1" xsi:type="tns:Complex5Param">
      <s1 xsi:type="xsd:string">First String</s1>
      <s2 xsi:type="xsd:string">Second String</s2>
      <i1 xsi:type="xsd:int">42</i1>
      <b1 xsi:type="xsd:boolean">true</b1>
    </tns:Complex5Param>
  </soap:Body>
</soap:Envelope>
*** end request from dotnet

*** start response from Axis
Content-Type:text/xml; charset=utf-8

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://xmlinterface.xcut.clareos.com"
xmlns:types="http://xmlinterface.xcut.clareos.com/encodedTypes"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <soap:Fault>
      <faultcode
xmlns:ns1="http://xml.apache.org/axis/">ns1:Server.userException</faultc
ode>
      <faultstring>java.lang.NullPointerException</faultstring>
      <detail>
        <ns2:stackTrace
xmlns:ns2="http://xml.apache.org/axis/">java.lang.NullPointerException
	at
org.apache.axis.providers.java.RPCProvider.processMessage(Unknown
Source)
	at org.apache.axis.providers.java.JavaProvider.invoke(Unknown
Source)
	at org.apache.axis.strategies.InvocationStrategy.visit(Unknown
Source)
	at org.apache.axis.SimpleChain.doVisiting(Unknown Source)
	at org.apache.axis.SimpleChain.invoke(Unknown Source)
	at org.apache.axis.server.AxisServer.invoke(Unknown Source)
	at org.apache.axis.transport.http.AxisServlet.doPost(Unknown
Source)
.
.
.
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:
1115)
	at java.lang.Thread.run(Thread.java:479)
</ns2:stackTrace>
      </detail>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>
*** end response from Axis

Here is a request from an Axis client that works:

*** start request from Axis client
POST /xcut-app/services/Complex5 HTTP/1.0
Content-Length: 786
Host: localhost
Content-Type: text/xml; charset=utf-8
SOAPAction: ""

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
 <SOAP-ENV:Body>
  <ns1:getC5ParamTest xmlns:ns1="http://xmlinterface.xcut.clareos.com">
   <in0 href="#id0"/>
  </ns1:getC5ParamTest>
  <multiRef id="id0" SOAP-ENC:root="0" xsi:type="ns2:Complex5Param"
xmlns:ns2="http://xmlinterface.xcut.clareos.com">
   <s2 xsi:type="xsd:string">Anoth</s2>
   <i1 xsi:type="xsd:int">42</i1>
   <b1 xsi:type="xsd:boolean">true</b1>
   <s1 xsi:nil="true"/>
  </multiRef>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
*** end request from Axis client

The request looks good to me? The service just returns true. I would
appreciate any help.

~ Peter



-----Original Message-----
From: Vidyanand Murunikkara [mailto:Vidyanand@infravio.com] 
Sent: Wednesday, April 03, 2002 6:11 PM
To: axis-user@xml.apache.org
Subject: RE: Problems calling Axis service from .NET C# client

Peter

I have seen this happen in case of dotnet .. and the reason it fails is
because dotnet expects the XML corresponding to the object that it
deserializes to have no prefixes .. 

if all the prefixes are stripped off for the elements in the following
part I guess it shld work.

 <ns1:loginResponse
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://service.xmlinterface.xcut.clareos.com">
      <loginResult href="#id0" />
    </ns1:loginResponse>
    <multiRef id="id0" SOAP-ENC:root="0" xsi:type="ns2:XcutResponse"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://service.xmlinterface.xcut.clareos.com">
      <ns2:ReturnCode xsi:type="xsd:int">0</ns2:ReturnCode>
      <ns2:ReturnStatus xsi:type="xsd:boolean">true</ns2:ReturnStatus>
      <ns2:ReturnString xsi:type="xsd:string">Logged
in!</ns2:ReturnString>

Vidyanand.

-----Original Message-----
From: Peter A. Kozma [mailto:pkozma@clareos.com]
Sent: Friday, March 29, 2002 12:53 PM
To: axis-user@xml.apache.org
Subject: RE: Problems calling Axis service from .NET C# client


Stan,

Thanks for taking a look. I've tried proxy DLL from "wsdl.exe", adding a
web reference through .NET, and the webservice studio. While I can
generate and build the proxy in all methods named and see the SOAP
request and response, I cannot get a valid response back in .NET land
(as described in original note).

~ Peter



-----Original Message-----
From: Stan Jordan [mailto:skjordan@worldnet.att.net] 
Sent: Friday, March 29, 2002 3:46 PM
To: axis-user@xml.apache.org
Subject: Re: Problems calling Axis service from .NET C# client

Peter...
The usual way to build a C# client is:
1) Create proxy DLL from wsdl file, using this executable:
   c:\Program Files\Microsoft.NET\FrameworkSDK\Bin\wsdl.exe
2) Write your client, which uses the proxy.
Did you create your client this way?  If not, maybe you should give it a
try.

Another (better) way to create the proxy is via ".NET WebService Studio"
which you can download here:
  http://www.gotdotnet.com/team/tools/web_svc/default.aspx
Personally, I love the studio, because it:
1)  generates both proxy and client, and
2)  provides a nice GUI for entering input data to test your service.

I tried your wsdl file with .NET WebService Studio, and it seems to be
okay
(I was able to create a proxy and client).
Good luck.
Stan

----- Original Message -----
From: "Peter A. Kozma" <pk...@clareos.com>
To: <ax...@xml.apache.org>
Sent: Friday, March 29, 2002 8:57 AM
Subject: RE: Problems calling Axis service from .NET C# client


Hi Stan,

Attached is the entire wsdl file. Thanks!

I added a trace extension to the .NET method to follow the message
through the various stages... no luck so far.

~ Peter


-----Original Message-----
From: Stan Jordan [mailto:skjordan@worldnet.att.net]
Sent: Friday, March 29, 2002 10:48 AM
To: axis-user@xml.apache.org
Subject: Re: Problems calling Axis service from .NET C# client

Peter...
Send me the entire wsdl file, and I can prolly help. Or send me the
URL, if you have deployed your service to the web.
Stan
----- Original Message -----
From: Peter A. Kozma
To: axis-user@xml.apache.org
Sent: Friday, March 29, 2002 6:49 AM
Subject: Problems calling Axis service from .NET C# client

I have a web services method running on Axis (beta 1) that looks like:
XcutPlay1Response login (String id, String pw);

The return type is complex (see WSDL below). Calling from an Axis client
works fine. When invoked from .NET, I get an empty response object back
(string = null, int = 0, bool = false) and no errors. I look at the
actual SOAP messages and everything going up and down looks good (see
response message below). My service is getting invoked. Calling Axis
from .NET works with methods that do not involve complex types.

Anyone have any ideas?

Thanks.

*** start response message
Content-Type:text/xml; charset=utf-8

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SOAP-ENV:Body>
    <ns1:loginResponse
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://service.xmlinterface.xcut.clareos.com">
      <loginResult href="#id0" />
    </ns1:loginResponse>
    <multiRef id="id0" SOAP-ENC:root="0" xsi:type="ns2:XcutResponse"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://service.xmlinterface.xcut.clareos.com">
      <ns2:ReturnCode xsi:type="xsd:int">0</ns2:ReturnCode>
      <ns2:ReturnStatus xsi:type="xsd:boolean">true</ns2:ReturnStatus>
      <ns2:ReturnString xsi:type="xsd:string">Logged
in!</ns2:ReturnString>
    </multiRef>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
*** end response message

*** start WSDL
.
<types>
  <schema targetNamespace="http://service.xmlinterface.xcut.clareos.com"
xmlns="http://www.w3.org/2001/XMLSchema">
   <complexType name="XcutPlay1Response">
    <sequence>
     <element name="ReturnCode" type="xsd:int"/>
     <element name="ReturnString" nillable="true" type="xsd:string"/>
     <element name="ReturnStatus" type="xsd:boolean"/>
    </sequence>
   </complexType>
   <element name="XcutPlay1Response" nillable="true"
type="tns1:XcutPlay1Response"/>
  </schema>
 </types>
.
   <wsdl:message name="loginResponse">

      <wsdl:part name="return" type="tns1:XcutPlay1Response"/>

   </wsdl:message>
.
      <wsdl:operation name="login" parameterOrder="in0 in1">

         <wsdl:input message="intf:loginRequest"/>

         <wsdl:output message="intf:loginResponse"/>

      </wsdl:operation>
.
*** end WSDL

*** start C#
    /// <remarks/>
    [System.Web.Services.Protocols.SoapRpcMethodAttribute("",
RequestNamespace="http://service.xmlinterface.xcut.clareos.com",
ResponseNamespace="http://service.xmlinterface.xcut.clareos.com")]
    [return: System.Xml.Serialization.SoapElementAttribute("return")]
    public XcutResponse login(string in0, string in1) {
        object[] results = this.Invoke("login", new object[] {
                    in0,
                    in1});
        return ((XcutResponse)(results[0]));
    }

.

/// <remarks/>
[System.Xml.Serialization.SoapTypeAttribute("XcutResponse",
"http://service.xmlinterface.xcut.clareos.com")]
public class XcutResponse {

    /// <remarks/>
    public int ReturnCode;

    /// <remarks/>
    public string ReturnString;

    /// <remarks/>
    public bool ReturnStatus;
}

*** end C#