axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Hook (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Commented: (AXIS-1467) Serialisation errors in .NET client with Axis 1.2 rpc/enc service
Date Mon, 24 Jan 2005 03:25:31 GMT
     [ http://issues.apache.org/jira/browse/AXIS-1467?page=comments#action_57989 ]
     
Robert Hook commented on AXIS-1467:
-----------------------------------

While the additional "dotNetSoapEncFix" *may* resolve the problem, a variant of the problem
exists currently with JBuilder 2005. This product is shipped with a version of Axis 1.2RC2,
however I have strong reasons to believe that the version shipped is (a) a modified version,
(b) not based on the build that includes support for this flag.

I will be posting an urgent issue with Borland to try to resolve this problem, as it is a
show-stopper that definitely causes previously functional web services to break. However,
I am also posting this here so that anyone else who stumbles across this problem knows they
are not alone.

.Net 1.1 fails horribly for a web service that returns a string array. For example, the following
simple service:

package au.com.hpa;
import java.util.*;
public class BasicService {
    public BasicService() {
    }
    public int GetSize() {
        return 42;
    }
    public String GetName() {
        return "Zarniwoop";
    }
    public String[] GetReasons() {
        return new String[] {"Madness", "Chaos", "Terror", "Coffee Depletion"};
    }

    public List GetReasonList() {
        ArrayList l = new ArrayList();
        String[] f = this.GetReasons();
        for (int i=0; i<f.length; i++)
            l.add(f[i]);
        return l;
    }
}

Causes .Net (I am testing with .NET WebSErvices Studio, but have replicated the behaviour
with custom-built clients) to throw an exception when GetReasons() is invoked

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an
invocation. ---> System.InvalidOperationException: There is an error in XML document (1,
312). ---> System.InvalidOperationException: The specified type was not recognized: name='string',
namespace='http://schemas.xmlsoap.org/soap/encoding/', at <GetReasonsReturn xmlns=''>.
   at System.Xml.Serialization.XmlSerializationReader.GetPrimitiveType(XmlQualifiedName typeName,
Boolean throwOnUnknown)
   at System.Xml.Serialization.XmlSerializationReader.ReadArray(String typeName, String typeNs)
   at System.Xml.Serialization.XmlSerializationReader.ReadReferencingElement(String name,
String ns, Boolean elementCanBeType, String& fixupReference)
   at System.Xml.Serialization.XmlSerializationReader.ReadReferencingElement(String name,
String ns, String& fixupReference)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read13_GetReasonsResponse()


The generated WSDL is:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://hpa.com.au/" xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://hpa.com.au/" xmlns:intf="http://hpa.com.au/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.2RC2
Built on Dec 08, 2004 (12:13:10 PST)-->
 <wsdl:types>
  <schema targetNamespace="http://hpa.com.au/" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://xml.apache.org/xml-soap"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="ArrayOf_soapenc_string">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="soapenc:string[]"/>
     </restriction>
    </complexContent>
   </complexType>
   <complexType name="ArrayOf_xsd_anyType">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:anyType[]"/>
     </restriction>
    </complexContent>
   </complexType>
  </schema>
  <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://hpa.com.au/"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="Vector">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:anyType"/>
    </sequence>
   </complexType>
  </schema>
 </wsdl:types>
   <wsdl:message name="GetReasonsRequest">
   </wsdl:message>
   <wsdl:message name="GetSizeRequest">
   </wsdl:message>
   <wsdl:message name="GetSizeResponse">
      <wsdl:part name="GetSizeReturn" type="xsd:int"/>
   </wsdl:message>
   <wsdl:message name="GetNameRequest">
   </wsdl:message>
   <wsdl:message name="GetNameResponse">
      <wsdl:part name="GetNameReturn" type="soapenc:string"/>
   </wsdl:message>
   <wsdl:message name="GetReasonListResponse">
      <wsdl:part name="GetReasonListReturn" type="impl:ArrayOf_xsd_anyType"/>
   </wsdl:message>
   <wsdl:message name="GetReasonListRequest">
   </wsdl:message>
   <wsdl:message name="GetReasonsResponse">
      <wsdl:part name="GetReasonsReturn" type="impl:ArrayOf_soapenc_string"/>
   </wsdl:message>
   <wsdl:portType name="BasicService">
      <wsdl:operation name="GetSize">
         <wsdl:input message="impl:GetSizeRequest" name="GetSizeRequest"/>
         <wsdl:output message="impl:GetSizeResponse" name="GetSizeResponse"/>
      </wsdl:operation>
      <wsdl:operation name="GetName">
         <wsdl:input message="impl:GetNameRequest" name="GetNameRequest"/>
         <wsdl:output message="impl:GetNameResponse" name="GetNameResponse"/>
      </wsdl:operation>
      <wsdl:operation name="GetReasons">
         <wsdl:input message="impl:GetReasonsRequest" name="GetReasonsRequest"/>
         <wsdl:output message="impl:GetReasonsResponse" name="GetReasonsResponse"/>
      </wsdl:operation>
      <wsdl:operation name="GetReasonList">
         <wsdl:input message="impl:GetReasonListRequest" name="GetReasonListRequest"/>
         <wsdl:output message="impl:GetReasonListResponse" name="GetReasonListResponse"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="BasicServiceSoapBinding" type="impl:BasicService">
      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="GetSize">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="GetSizeRequest">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://hpa.com.au/"
use="encoded"/>
         </wsdl:input>
         <wsdl:output name="GetSizeResponse">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://hpa.com.au/"
use="encoded"/>
         </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="GetName">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="GetNameRequest">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://hpa.com.au/"
use="encoded"/>
         </wsdl:input>
         <wsdl:output name="GetNameResponse">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://hpa.com.au/"
use="encoded"/>
         </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="GetReasons">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="GetReasonsRequest">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://hpa.com.au/"
use="encoded"/>
         </wsdl:input>
         <wsdl:output name="GetReasonsResponse">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://hpa.com.au/"
use="encoded"/>
         </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="GetReasonList">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="GetReasonListRequest">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://hpa.com.au/"
use="encoded"/>
         </wsdl:input>
         <wsdl:output name="GetReasonListResponse">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://hpa.com.au/"
use="encoded"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="BasicServiceService">
      <wsdl:port binding="impl:BasicServiceSoapBinding" name="BasicService">
         <wsdlsoap:address location="http://localhost:8080/TestBaseService/services/BasicService"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>


> Serialisation errors in .NET client with Axis 1.2 rpc/enc service
> -----------------------------------------------------------------
>
>          Key: AXIS-1467
>          URL: http://issues.apache.org/jira/browse/AXIS-1467
>      Project: Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2 Beta
>  Environment: VB .NET client on Win2000, Axis 1.2beta2 server inside JBoss/Jetty on Solaris.
>     Reporter: Anand Natrajan
>      Fix For: 1.2
>  Attachments: server-config.wsdd
>
> I'm seeing some client-side serialisation errors when I try to access
> my Axis 1.2 rpc/encoded service using a VB .NET client. This same
> combination worked in Axis 1.1, but fails with Axis 1.2. I have used
> the Axis 1.2 beta from June 14th as well as July 15th separately.
> Below is a complete trace of what I did and what the error is.
> I've shown
> - the signature of the Java service
> - the java2wsdl Ant task used to generate the WSDL
> - the wsdl2java Ant task used to generate deploy.wsdd
> - the VB .NET client
> - the SOAP request generated by the .NET client
> - the SOAP response when the service was deployed under Axis 1.1
> - the SOAP response when the service was deployed under Axis 1.2
> The items shown as ellipses have been elided because they're simply
> values irrelevant to the operation.
> The only difference between the two scenarios (1.1 vs. 1.2) is that
> I changed the Axis libraries (axis*.jar, commons*.jar, saaj.jar,
> wsdl4j.jar, jaxrpc.jar) and re-ran the procedure right from compiling
> the service and running java2wsdl and so on.
> What has changed between Axis 1.1 and 1.2 in this respect?
> <!-- Java signature of service -->
> import com.abc.api.common.MyPrincipal;
> public class MyAPIRpcEnc
> {
>     public String[] whoami(MyPrincipal principal)
>         throws RemoteException
> 	{
> 		...
> 	}
> }
> <!-- java2wsdl task -->
>         <axis-java2wsdl
>             classname="com.abc.ws.server.MyAPIRpcEnc"
>             style="rpc"
>             use="encoded"
>             namespace="urn:${apiName}"
> 			location="http://LOCAL_HOST:8080/axis/services/MyAPIRpcEnc"
> 			output="${basedir}/${wsdl.build.dir}/MyAPIRpcEnc.wsdl">
>             <classpath refid="classpath"/>
>             <mapping package="com.abc.api.common"
>                 namespace="urn:MyAPICommon"/>
> 		</axis-java2wsdl>
> <!-- wsdl2java task -->
>         <axis-wsdl2java
>             output="${outDir}"
>             url="${basedir}/${wsdl.build.dir}/MyAPIRpcEnc.wsdl"
>             serverside="true">
>             <mapping namespace="urn:MyAPIRpcEnc"
>                 package="com.abc.ws.stubs"/>
>             <mapping namespace="urn:MyAPICommon"
>                 package="com.abc.api.common"/>
>         </axis-wsdl2java>
>         <!-- Paste deploy.wsdd into server-config.wsdd -->
> <!-- VB .NET client call -->
> ...
> Private Sub actualTests()
> 	Dim principal As New MyAPIRpcEnc.MyPrincipal
> 	principal.name = "Administrator"
> 	principal.password = "Administrator"
> 	principal.authService = "DefaultAuthService"
> 	principal.authServiceType = "Grid"
> 	principal.domain = "mydomain.abc.com"
> 	Dim asdn As New MyAPIRpcEnc.MyAPIRpcEncService
> 	asdn.whoami(principal)
> End Sub
> ...
> <!-- VB .NET request -->
> <?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="urn:MyAPIRpcEnc"
> 	xmlns:types="urn:MyAPIRpcEnc/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:whoami>
> 			<principal href="#id1" />
> 		</tns:whoami>
> 		<q1:MyPrincipal id="id1"
> 			xsi:type="q1:MyPrincipal"
> 			xmlns:q1="urn:MyAPICommon">
> 			<authService xsi:type="xsd:string">DefaultAuthService</authService>
> 			<authServiceType xsi:type="xsd:string">Grid</authServiceType>
> 			<domain xsi:type="xsd:string">mydomain.abc.com</domain>
> 			<name xsi:type="xsd:string">Administrator</name>
> 			<password xsi:type="xsd:string">Administrator</password>
> 		</q1:MyPrincipal>
> 	</soap:Body>
> </soap:Envelope>
> <!-- Axis 1.1 response -->
> <?xml version="1.0" encoding="UTF-8"?>
> <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>
> 		<ns1:whoamiResponse
> 			soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> 			xmlns:ns1="urn:MyAPIRpcEnc">
> 			<whoamiReturn soapenc:arrayType="xsd:string[9]"
> 				xsi:type="soapenc:Array"
> 				xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
> 				<item>...</item>
> 				<item>...</item>
> 				<item>...</item>
> 				<item>...</item>
> 				<item>...</item>
> 				<item>...</item>
> 				<item>...</item>
> 				<item>...</item>
> 				<item>...</item>
> 			</whoamiReturn>
> 		</ns1:whoamiResponse>
> 	</soapenv:Body>
> </soapenv:Envelope>
> <!-- Axis 1.2 beta response (June 14th and July 15th releases) -->
> <?xml version="1.0" encoding="utf-8"?>
> <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>
> 		<ns1:whoamiResponse
> 			soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> 			xmlns:ns1="urn:MyAPIRpcEnc">
> 			<whoamiReturn soapenc:arrayType="soapenc:string[9]"
> 				xsi:type="ns1:ArrayOf_xsd_string"
> 				xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
> 				<item xsi:type="soapenc:string">...</item>
> 				<item xsi:type="soapenc:string">...</item>
> 				<item xsi:type="soapenc:string">...</item>
> 				<item xsi:type="soapenc:string">...</item>
> 				<item xsi:type="soapenc:string">...</item>
> 				<item xsi:type="soapenc:string">...</item>
> 				<item xsi:type="soapenc:string">...</item>
> 				<item xsi:type="soapenc:string">...</item>
> 				<item xsi:type="soapenc:string">...</item>
> 			</whoamiReturn>
> 		</ns1:whoamiResponse>
> 	</soapenv:Body>
> </soapenv:Envelope>
> <!-- VB .NET error -->
> Unhandled Exception: System.InvalidOperationException: There is an error in XML
> document (1, 308). ---> System.InvalidOperationException: The specified type was
>  not recognized: name='string', namespace='http://schemas.xmlsoap.org/soap/encoding/',
at <whoamiReturn xmlns=''>.
>    at System.Xml.Serialization.XmlSerializationReader.GetPrimitiveType(XmlQualifiedName
typeName, Boolean throwOnUnknown)
>    at System.Xml.Serialization.XmlSerializationReader.ReadArray(String typeName, String
typeNs)
>    at System.Xml.Serialization.XmlSerializationReader.ReadReferencingElement(String name,
String ns, Boolean elementCanBeType, String& fixupReference)
>    at System.Xml.Serialization.XmlSerializationReader.ReadReferencingElement(String name,
String ns, String& fixupReference)
>    at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read70_whoamiResponse()
>    --- End of inner exception stack trace ---
>    at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String
encodingStyle)
>    at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
>    at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
>    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName,
Object[] parameters)
>    at DotNetWSAPITest.MyAPIRpcEnc.MyAPIRpcEncService.whoami(MyPrincipal principal)
>    at DotNetWSAPITest.DotNetWSAPITest.actualTests(MyPrincipal principal)
>    at DotNetWSAPITest.DotNetWSAPITest.testMyWSAPI()
>    at DotNetWSAPITest.DotNetWSAPITest.Main()

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Mime
View raw message