RE: .NET based SOAP client inter-op issue with Apache Axis based web service
- From: "Nishant"<nishant.vij@xxxxxxxxxxx>
- Date: Thu, 02 Aug 2007 08:32:05 GMT
Hi,
I've developed a web service using Apache Axis 1.4 (WSDL shown at the bottom
of this post) which is deployed to Apache Tomcat 5.5. Using VisualStudio.NET
2003 I've created a small .NET (1.1) based test client to invoke one of the
methods. I get the following exception thrown by the client when I invoke
the loginUser method on the web service:
An unhandled exception of type 'System.InvalidOperationException' occurred
in system.xml.dll
Additional information: There is an error in XML document (1, 2457).
Unhandled Exception: System.InvalidOperationException: There is an error in
XML document (1, 2457). ---> System.InvalidCastException: Cannot assign
object of type
VIPerProvisionTest.provision.ServiceDescriptor to an object of type
VIPerProvisionTest.provision.ServiceDescriptor[].
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.fixup_Read4_ServiceList(Object
objFixup)
at System.Xml.Serialization.XmlSerializationReader.DoFixups()
at
System.Xml.Serialization.XmlSerializationReader.ReadReferencedElements()
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read10_loginUserResponse()
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader, XmlDeserializationEvents events)
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 VIPerProvisionTest.provision.ProvisionCommandsService.loginUser(String
userName, String password, AuthenticationToken& authtoken, Organisation&
organisation, Boolean& loginUserReturn) in
d:\projects\c++\viperprovisiontest\web
references\provision\reference.cs:line 37
at VIPerProvisionTest.Form1..ctor() in
d:\projects\c++\viperprovisiontest\form1.cs:line 35
at VIPerProvisionTest.Form1.Main() in
d:\projects\c++\viperprovisiontest\form1.cs:line 90
The program '[1908] VIPerProvisionTest.exe' has exited with code 0 (0x0).
The problem seems to be with the ServiceList element. I've tried just
defining a ServiceDescriptor array in the WSDL (without the ServiceList
wrapper) but I get the same exception thrown. If I remove the ServiceList
from the definition of Organisation, or I change ServiceList for just a
single ServiceDescriptor, then the method invocation is successful. As far
as I can tell the SOAP response (shown below) emitted by Axis looks ok.
Am I defining the array incorrectly in the WSDL ? Does anyone have any idea
why the .NET SOAP implementation is having a problem handling this response
message ?
Thanks,
Tony
------------------------------------------------------------------------------------------------------------------
SOAP response to loginUser request generated by Apache Axis 1.4:
<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:loginUserResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="urn:soap.provision.viper.bt.com">
<authtoken xsi:type="ns1:AuthenticationToken">
<SessionID
xsi:type="xsd:string">509171851819014720v1pEr357ws1</SessionID>
</authtoken>
<organisation xsi:type="ns1:Organisation">
<ID xsi:type="xsd:int">1</ID>
<Name xsi:type="xsd:string">An Organisation</Name>
<ServiceList xsi:type="ns1:ServiceList">
<ServiceDescriptor xsi:type="ns1:ServiceDescriptor">
<Name xsi:type="xsd:string">A service</Name>
</ServiceDescriptor>
<ServiceDescriptor xsi:type="ns1:ServiceDescriptor">
<Name xsi:type="xsd:string">Another service</Name>
</ServiceDescriptor>
<ServiceDescriptor xsi:type="ns1:ServiceDescriptor">
<Name xsi:type="xsd:string">Yet another
service</Name>
</ServiceDescriptor>
</ServiceList>
</organisation>
<loginUserReturn xsi:type="xsd:boolean">true</loginUserReturn>
</ns1:loginUserResponse>
</soapenv:Body>
</soapenv:Envelope>
------------------------------------------------------------------------------------------------------------------
The WSDL for the web service (trimmed for the method and types of interest):
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:soap.provision.viper.bt.com"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="urn:soap.provision.viper.bt.com"
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:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:soap.provision.viper.bt.com">
<xs:complexType name="AuthenticationToken">
<xs:sequence>
<xs:element name="SessionID"
type="xs:string"
nillable="false"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ServiceDescriptor">
<xs:sequence>
<xs:element name="Name"
type="xs:string"
nillable="false"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ServiceList">
<xs:sequence>
<xs:element name="ServiceDescriptor"
type="impl:ServiceDescriptor"
minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Organisation">
<xs:sequence>
<xs:element name="ID"
type="xs:int"
nillable="false"/>
<xs:element name="Name"
type="xs:string"
nillable="false"/>
<xs:element name="ServiceList"
type="impl:ServiceList"
minOccurs="1"
maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<!-- Requests -->
<wsdl:message name="loginUserRequest">
<wsdl:part name="userName" type="soapenc:string"/>
<wsdl:part name="password" type="soapenc:string"/>
</wsdl:message>
<!-- Responses -->
<wsdl:message name="loginUserResponse">
<wsdl:part name="authtoken" type="impl:AuthenticationToken"/>
<wsdl:part name="organisation" type="impl:Organisation"/>
<wsdl:part name="loginUserReturn" type="soapenc:boolean" />
</wsdl:message>
<!-- Operations -->
<wsdl:portType name="provisionCommands">
<wsdl:operation name="loginUser" parameterOrder="userName password">
<wsdl:input message="impl:loginUserRequest"
name="loginUserRequest"/>
<wsdl:output message="impl:loginUserResponse"
name="loginUserResponse" />
</wsdl:operation>
</wsdl:portType>
<!-- Bindings -->
<wsdl:binding name="provisionSoapBinding" type="impl:provisionCommands">
<wsdlsoap:binding style="RPC"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="loginUser">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="loginUserRequest">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:soap.provision.viper.bt.com"
use="encoded"/>
</wsdl:input>
<wsdl:output name="loginUserResponse" >
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace=":urn:soap.provision.viper.bt.com"
use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ProvisionCommandsService">
<wsdl:port binding="impl:provisionSoapBinding" name="provision">
<wsdlsoap:address
location="http://localhost:8080/axis/services/provision"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Hi,
I want to implement a web service notification in java. Can anyone help me with a working example?
Thanks,
Nishant
BizTalk Utilities - Frustration free BizTalk Adapters
http://www.topxml.com/biztalkutilities
.
- References:
- .NET based SOAP client inter-op issue with Apache Axis based web service
- From: Tony Stephens
- .NET based SOAP client inter-op issue with Apache Axis based web service
- Prev by Date: Re: Internal Web Service
- Next by Date: Re: How to avoid first time exceptions when calling a webmethod ?
- Previous by thread: Re: .NET based SOAP client inter-op issue with Apache Axis based w
- Next by thread: web service issue
- Index(es):
Relevant Pages
|