Hello Martin,
Apologies in advance if the comment below is not addressing the
right question....
I had to set a serializer and deserializer when passing a complex
type or when expecting a complex type as a return value from a call.
I did something like this on my call object:
QName classQName = new QName("http://my.namespace", "Foo");
Class cl = Foo.class;
BeanSerializerFactory bsf =
new BeanSerializerFactory(cl, classQName);
BeanDeserializerFactory bdf =
new BeanDeserializerFactory(cl, classQName);
call.registerTypeMapping(cl, classQName, bsf, bdf);
This was for expecting a Java Bean as a return value. I saw a
section about complex types that are not Java beans in the AXIS
user's guide. Look at the section "Encoding your Beans - the
Bean Serializer". Also see the section below it:
"When Beans Are Not Enough - Custom Serialization".
Vartan
--- Martin Wunderlich <[EMAIL PROTECTED]> wrote:
> Hello again,
>
> Since there haven't been any replies, yet, to this questions, I
> thought I could post the relevant bit of the web service's WSDL.
> Please find it below. Sorry about the long post. As I said, the
> sayHello service method is working perfectly fine. It's just the one
> that's using the complex type User that's causing me problems. I'd be
> most greatly for any hints into the right direction.
>
> All the best,
>
> Martin
>
>
> <wsdl:definitions targetNamespace="urn:mypackage.com">
> <!--
> WSDL created by Apache Axis version: 1.2.1
> Built on Jun 14, 2005 (09:15:57 EDT)
> -->
> <wsdl:types>
> <schema targetNamespace="urn:mypackage.com">
> <import
> namespace="http://dataObjects.database.mypackage.com"/>
> <import
> namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
>
> <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://dataObjects.database.mypackage.com">
> <import namespace="urn:mypackage.com"/>
> <import
> namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
> <complexType abstract="true"
> name="AbstractUser">
> <sequence>
> <element
> name="contactsForUser1" nillable="true"
> type="impl:ArrayOf_xsd_anyType"/>
> <element
> name="contactsForUser2" nillable="true"
> type="impl:ArrayOf_xsd_anyType"/>
> <element name="email"
> nillable="true" type="xsd:string"/>
> <element name="firstName"
> nillable="true" type="xsd:string"/>
> <element name="id"
> nillable="true" type="xsd:int"/>
> <element name="lastName"
> nillable="true" type="xsd:string"/>
> <element name="password"
> nillable="true" type="xsd:string"/>
> <element name="projects"
> nillable="true" type="impl:ArrayOf_xsd_anyType"/>
> <element name="targetteams"
> nillable="true" type="impl:ArrayOf_xsd_anyType"/>
> </sequence>
> </complexType>
> <complexType name="User">
> <complexContent>
> <extension base="tns1:AbstractUser">
> <sequence/>
> </extension>
> </complexContent>
> </complexType>
>
> [...]
>
> <wsdl:message name="registerRequest">
> <wsdl:part name="in0" type="tns1:User"/>
> </wsdl:message>
>
> <wsdl:message name="sayHelloRequest">
> <wsdl:part name="in0" type="soapenc:string"/>
> </wsdl:message>
>
> <wsdl:message name="registerResponse">
> </wsdl:message>
>
> <wsdl:message name="sayHelloResponse">
> <wsdl:part name="sayHelloReturn"
> type="soapenc:string"/>
> </wsdl:message>
>
> <wsdl:portType name="Handler">
>
> <wsdl:operation name="register" parameterOrder="in0">
> <wsdl:input message="impl:registerRequest"
> name="registerRequest"/>
> <wsdl:output message="impl:registerResponse"
> name="registerResponse"/>
> <wsdl:fault message="impl:MyException"
> name="MyException"/>
> </wsdl:operation>
>
> <wsdl:operation name="sayHello" parameterOrder="in0">
> <wsdl:input message="impl:sayHelloRequest"
> name="sayHelloRequest"/>
> <wsdl:output message="impl:sayHelloResponse"
> name="sayHelloResponse"/>
> </wsdl:operation>
> </wsdl:portType>
>
> <wsdl:binding name="HandlerSoapBinding" type="impl:Handler">
> <wsdlsoap:binding style="rpc"
> transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsdl:operation name="register">
> <wsdlsoap:operation soapAction=""/>
> <wsdl:input name="registerRequest">
> <wsdlsoap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> namespace="urn:mypackage.com" use="encoded"/>
> </wsdl:input>
> <wsdl:output name="registerResponse">
> <wsdlsoap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> namespace="urn:mypackage.com" use="encoded"/>
> </wsdl:output>
>
> <wsdl:fault name="MyException">
> <wsdlsoap:fault
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> name="MyException" namespace="urn:mypackage.com" use="encoded"/>
> </wsdl:fault>
> </wsdl:operation>
>
> <wsdl:operation name="sayHello">
> <wsdlsoap:operation soapAction=""/>
> <wsdl:input name="sayHelloRequest">
> <wsdlsoap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> namespace="urn:mypackage.com" use="encoded"/>
> </wsdl:input>
> <wsdl:output name="sayHelloResponse">
> <wsdlsoap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> namespace="urn:mypackage.com" use="encoded"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
>
> <wsdl:service name="IHandlerService">
> <wsdl:port binding="impl:HandlerSoapBinding" name="Handler">
> <wsdlsoap:address
> location="http://localhost/MyProject/services/Handler"/>
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
>
> > Dear all,
>
> > I have deployed a couple of web services and I keep getting an
> exception
> > when calling one of them. I am calling two services. One takes as
> > input a String and returns a String. This one works just fine.
> Another one
> > takes as input a complex type (a Java bean) and has no return value.
> > This is the one that fails with the somewhat cryptic
> > exception give below (both are called using the auto-generated test
> > case). The web service's method
> > is called register() and basically meant to write a User object to a
> > database. Calling "getCause()" returns a null value. The object I
> pass in
> > looks fine. I can out.println() its values.
>
> > Could anyone give me a hint as to what this means? Thanks a lot in
> > advance.
>
> > Cheers,
>
> > Martin
>
> > AxisFault
> > faultCode:
> > {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> > faultSubcode:
> > faultString: java.lang.reflect.InvocationTargetException
> > faultActor:
> > faultNode:
> > faultDetail:
> > {http://xml.apache.org/axis/}hostname:Hermes
>
> > java.lang.reflect.InvocationTargetException
> > at
> >
>
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
> > at
> >
>
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
> > at
> >
>
org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
> > at
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com