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 David Thielen <da...@windward.net> on 2004/07/18 01:45:27 UTC

[axis]: more on can't access java WS from .net

Hi;

 

I have a case where I have created a java web service using Axis setting the
SOAP in doc/literal format. My java client can access it fine. My C# client
throws an exception. Also, as the SOAP packets below show - two very weird
things:

1.	The C# requests have no method name. This clearly is a major problem
but why did wsdl.exe not create one and how do I fix this?
2.	The response to the C# client has a 1ec before and a 0 after the
SOAP packet. This has occurred all 3 times I tried it - yet no extra chars
for the java client response.

 

******************

The SOAP for the C# Request (sent by C# client):

POST /axis/services/WindwardReports HTTP/1.1

VsDebuggerCausalityData: Aw{.lots of A's.}AA

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client
Protocol 1.1.4322.573)

Content-Type: text/xml; charset=utf-8

SOAPAction: ""

Content-Length: 236

Expect: 100-continue

Connection: Keep-Alive

Host: 127.0.0.1:1234

 

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

      xmlns:xsd="http://www.w3.org/2001/XMLSchema">

      <soap:Body />

</soap:Envelope>

 

The SOAP for the C# Response (returned by java web service):

HTTP/1.1 100 Continue

 

HTTP/1.1 500 Internal Server Error

Set-Cookie: JSESSIONID=2A813F0FBC668645B9AD3F11E862B92D; Path=/axis

Content-Type: text/xml;charset=utf-8

Transfer-Encoding: chunked

Date: Sat, 17 Jul 2004 23:21:41 GMT

Server: Apache-Coyote/1.1

Connection: close

 

1ec

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 

      xmlns:xsd="http://www.w3.org/2001/XMLSchema" 

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

      <soapenv:Body>

 
<soapenv:Fault><faultcode>soapenv:Server.userException</faultcode>

                  <faultstring>java.lang.ArrayIndexOutOfBoundsException:
Array index out of range: 0</faultstring>

                  <detail><ns1:hostname
xmlns:ns1="http://xml.apache.org/axis/">belle</ns1:hostname></detail>

            </soapenv:Fault>

      </soapenv:Body>

</soapenv:Envelope>

0

 

******************

The SOAP for the java Request (sent by java client):

POST /axis/services/WindwardReports HTTP/1.0

Content-Type: text/xml; charset=utf-8

Accept: application/soap+xml, application/dime, multipart/related, text/*

User-Agent: Axis/1.2beta2

Host: 127.0.0.1:1234

Cache-Control: no-cache

Pragma: no-cache

SOAPAction: ""

Content-Length: 245

<soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/

xmlns:xsd="http://www.w3.org/2001/XMLSchema" 

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Body>

<getVersion xmlns=""/>

</soapenv:Body>

</soapenv:Envelope>

 

The SOAP for the java Response (returned by java web service):

HTTP/1.1 200 OK

Set-Cookie: JSESSIONID=26C2F2A0CF2A7C201B9FE4916F9D4B78; Path=/axis

Content-Type: text/xml;charset=utf-8

Date: Sat, 17 Jul 2004 23:34:58 GMT

Server: Apache-Coyote/1.1

Connection: close

<soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/

xmlns:xsd="http://www.w3.org/2001/XMLSchema" 

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Body>

<getVersionReturn xmlns="urn:windward.net">3.2.1</getVersionReturn>

</soapenv:Body>

</soapenv:Envelope>

 

******************

The exception thrown is:

+          System.SystemException
{"java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0"}
System.SystemException

 

It is happening on the call:

            object[] results = this.Invoke("getVersion", new object[0]);

 

The code (with extra stuff removed) is:

  [System.Diagnostics.DebuggerStepThroughAttribute()]

  [System.ComponentModel.DesignerCategoryAttribute("code")]

 
[System.Web.Services.WebServiceBindingAttribute(Name="WindwardReportsSoapBin
ding", Namespace="urn:windward.net")]

  public class CreateReportService :
System.Web.Services.Protocols.SoapHttpClientProtocol {

        

    public CreateReportService() {

      this.Url = "http://localhost:8080/axis/services/WindwardReports";

    }

 

    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]

    [return:
System.Xml.Serialization.XmlElementAttribute("getVersionReturn",
Namespace="urn:windward.net")]

    public string getVersion() {

      object[] results = this.Invoke("getVersion", new object[0]);

      return ((string)(results[0]));

}

  }

 

Any ideas? Again, this works fine with a java client. Both java server &
client created with axis wsdl2java. C# code created with .net wsdl.exe.

 

Thanks - dave

 

Ps - my wsdl is attached


RE: [axis]: more on can't access java WS from .net

Posted by Anne Thomas Manes <an...@manes.net>.
David, 
 
.NET is doing exactly what you've told it to do. According to your WSDL,
when invoking the getVersion operation, the input message should have no
parts (i.e., an empty SOAP Body), as specified in your getVersionRequest
message definition:
 
   <wsdl:message name="getVersionRequest">
   </wsdl:message>
 
The fact that Axis has created a <getVersion> element for this request tells
me that Axis has a bug. (If you're using the latest build, then please file
a bug report.)
 
Doc/literal should never generate a method name element for you - that only
happens when using the RPC style. (either RPC/encoded or RPC/literal -
although neither Axis nor .NET supports RPC/literal). 
 
When using doc/literal, if you want the client to send a <getVersion>
element in the SOAP Body, then you must define this element in your schema
and specify this element as a message part in your getVersionRequest
message:
 
   <wsdl:message name="getVersionRequest">
      <wsdl:part name="parameters" element="impl:getVersion"
   </wsdl:message>
 
 
Note also that the "process" operation isn't valid doc/literal. If Axis
generated this WSDL for you, then this is also a bug. (Please file a bug
report.) When defining a doc/literal service, your input message must
contain at most one body part. You've defined three parts. If you'd like
Axis and .NET to automatically marshal your parameters for you, then you
should use the wrapped style. But either way (document or wrapped style) -
you need to define a wrapper element for your input message parameters.
 
For wrapped style, you need to define an element called "process", which is
a sequence of your input parameters:
 
   <xsd:element name="process">
     <xsd:complexType>
       <xsd:sequence>
         <xsd:element ref="impl:in0"/>
         <xsd:element ref="impl:in1"/>
         <xsd:element ref="impl:in2"/>
       </xsd:sequence>
     </xsd:complexType
   </xsd:element>
 
And you need to define your input message such that it contains only one
part, referencing this wrapper element:
 
   <wsdl:message name="processRequest">
      <wsdl:part element="impl:process" name="parameters"/>
   </wsdl:message>
 
And you need to remove the parameterOrder attribute from your portType
operation definition.
 
Anne
 
  _____  

From: David Thielen [mailto:david@windward.net] 
Sent: Saturday, July 17, 2004 7:45 PM
To: Axis Users
Subject: [axis]: more on can't access java WS from .net
 
Hi;
 
I have a case where I have created a java web service using Axis setting the
SOAP in doc/literal format. My java client can access it fine. My C# client
throws an exception. Also, as the SOAP packets below show - two very weird
things:
1.	The C# requests have no method name. This clearly is a major problem
but why did wsdl.exe not create one and how do I fix this?
2.	The response to the C# client has a 1ec before and a 0 after the
SOAP packet. This has occurred all 3 times I tried it - yet no extra chars
for the java client response.
 
******************
The SOAP for the C# Request (sent by C# client):
POST /axis/services/WindwardReports HTTP/1.1
VsDebuggerCausalityData: Aw{.lots of A's.}AA
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client
Protocol 1.1.4322.573)
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 236
Expect: 100-continue
Connection: Keep-Alive
Host: 127.0.0.1:1234
 
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soap:Body />
</soap:Envelope>
 
The SOAP for the C# Response (returned by java web service):
HTTP/1.1 100 Continue
 
HTTP/1.1 500 Internal Server Error
Set-Cookie: JSESSIONID=2A813F0FBC668645B9AD3F11E862B92D; Path=/axis
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Date: Sat, 17 Jul 2004 23:21:41 GMT
Server: Apache-Coyote/1.1
Connection: close
 
1ec
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
 
<soapenv:Fault><faultcode>soapenv:Server.userException</faultcode>
                  <faultstring>java.lang.ArrayIndexOutOfBoundsException:
Array index out of range: 0</faultstring>
                  <detail><ns1:hostname
xmlns:ns1="http://xml.apache.org/axis/">belle</ns1:hostname></detail>
            </soapenv:Fault>
      </soapenv:Body>
</soapenv:Envelope>
0
 
******************
The SOAP for the java Request (sent by java client):
POST /axis/services/WindwardReports HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.2beta2
Host: 127.0.0.1:1234
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 245
 
<soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getVersion xmlns=""/>
</soapenv:Body>
</soapenv:Envelope>
 
The SOAP for the java Response (returned by java web service):
HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=26C2F2A0CF2A7C201B9FE4916F9D4B78; Path=/axis
Content-Type: text/xml;charset=utf-8
Date: Sat, 17 Jul 2004 23:34:58 GMT
Server: Apache-Coyote/1.1
Connection: close
 
<soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getVersionReturn xmlns="urn:windward.net">3.2.1</getVersionReturn>
</soapenv:Body>
</soapenv:Envelope>
 
******************
The exception thrown is:
+          System.SystemException
{"java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0"}
System.SystemException
 
It is happening on the call:
            object[] results = this.Invoke("getVersion", new object[0]);
 
The code (with extra stuff removed) is:
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
 
[System.Web.Services.WebServiceBindingAttribute(Name="WindwardReportsSoapBin
ding", Namespace="urn:windward.net")]
  public class CreateReportService :
System.Web.Services.Protocols.SoapHttpClientProtocol {
        
    public CreateReportService() {
      this.Url = "http://localhost:8080/axis/services/WindwardReports";
    }
 
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
    [return:
System.Xml.Serialization.XmlElementAttribute("getVersionReturn",
Namespace="urn:windward.net")]
    public string getVersion() {
      object[] results = this.Invoke("getVersion", new object[0]);
      return ((string)(results[0]));
}
  }
 
Any ideas? Again, this works fine with a java client. Both java server &
client created with axis wsdl2java. C# code created with .net wsdl.exe.
 
Thanks - dave
 
Ps - my wsdl is attached