Hi Suresh,
This service is a wrapped document literal style service. There's two ways
of calling this type of service - using wrapped parts, or using unwrapped
parts. What's going wrong here is that WSIF is deciding to use wrapped
parts, where as your WSIF client program is trying to use unwrapped parts.
Looking at the WSDL message and schema there is a part called "parameters"
which is an element called "ReturnCodesResponse":
<message name="ReturnCodesSoapOut">
<part name="parameters" element="s0:ReturnCodesResponse" />
</message>
<s:element name="ReturnCodesResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ReturnCodesResult"
type="s0:ArrayOfAnyType" />
</s:sequence>
</s:complexType>
</s:element>
So using wrapped style WSIF would use a WSIFMessage part called
"parameters" which would have a value class called "ReturnCodesResponse"
which has getter and setter for a field called "ReturnCodesResult". Using
unwrapped style WSIF would use a WSIFMessage part called
"returnCodesResult" with a value class called "ArrayOfAnyType".
When deciding on what style to use WSIF looks at the parts in the input
WSIFMessage comparing them to the WSDL to see if you are using wrapped or
unwrapped parts.
In this case the operation has *no* input parts, so WSIF doesn't know what
you want and defaults to wrapped.
There's two ways to fix this - use WSDL2Java with the -W switch to generate
wrapped classes and then in your WSIF client code set up type mappings
like:
service.mapType(
new javax.xml.namespace.QName(
"http://ws.cdyne.com/",
"ReturnCodesResponse"),
ReturnCodesResponse.class);
service.mapType(
new javax.xml.namespace.QName(
"http://ws.cdyne.com/",
"ArrayOfAnyType"),
ArrayOfAnyType.class);
Alternatively you can force WSIF to use a particular style by setting a
part in the context message, for example:
WSIFOperation op = wsifPort.createOperation("ReturnCodes");
WSIFMessage ctx = op.getContext();
ctx.setObjectPart(
WSIFConstants.CONTEXT_OPERATION_STYLE,
WSIFConstants.CONTEXT_OPERATION_STYLE_WRAPPED);
op.setContext(ctx);
You will still need a mapType call for the ArrayOfAnyType class:
service.mapType(
new javax.xml.namespace.QName(
"http://ws.cdyne.com/",
"ArrayOfAnyType"),
ArrayOfAnyType.class);
Hope this helps.
One thing I guess worth thinking about is that perhaps in this case it
would be better for WSIF to default to using unwrapped parts, what do
others think?
...ant
Anthony Elder
[EMAIL PROTECTED]
Web Services Development
IBM UK Laboratories, Hursley Park
(+44) 01962 818320, x248320, MP208.
"Suresh" <[EMAIL PROTECTED]> on 27/02/2002 23:01:01
Please respond to [EMAIL PROTECTED]
To: <[EMAIL PROTECTED]>
cc:
Subject: Complex Types Confusion
Multibinding QuestionHi all,
I am trying to invoke a webservice hosted at
http://ws.cdyne.com/emailverify/ev.asmx?wsdl . I tried calling the
ReturnCodes operation
in it. The operation does not take any input params. I tried
calling the service without doing Service.mapType(..) when i did this i got
back the following error.
org.xml.sax.SAXException: Deserializing parameter 'ReturnCodesResponse':
could not find deserializer for type
{http://ws.cdyne.com/}ReturnCodesResponse
at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:297)
at
org.apache.axis.encoding.DeserializationContextImpl.startElement(Deserializa
tionContextImpl.java:921)
at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
699)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:224)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:331)
at org.apache.axis.client.Call.invoke(Call.java:2200)
at org.apache.axis.client.Call.invoke(Call.java:2099)
at org.apache.axis.client.Call.invoke(Call.java:1622)
at
org.apache.wsif.providers.soap.apacheaxis.WSIFOperation_ApacheAxis.invokeAXI
SDocStyle(Unknown Source)
at
org.apache.wsif.providers.soap.apacheaxis.WSIFOperation_ApacheAxis.invokeReq
uestResponseOperation(Unknown Source)
at
org.apache.wsif.providers.soap.apacheaxis.WSIFOperation_ApacheAxis.executeRe
questResponseOperation(Unknown Source)
at com.vergil.wsif.WSIFDynClient.executeWebService(WSIFDynClient.java:95)
at com.vergil.wsif.WSIFDynClient.invokeWebService(WSIFDynClient.java:218)
at com.vergil.wsif.WSIFDynClient.main(WSIFDynClient.java:35)
So i created client stubs using wsdl2java util of axis and registered
the "ReturnCodesResponse" Qname with the ArrayOfAnyType Class that
wsdl2java
generated.
When i tried invoking the service now i got back the following error
org.xml.sax.SAXException: Invalid element in
com.wsif.evSoap.ReturnCodes.ArrayOfAnyType - ReturnCodesResult
at
org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.
java:260)
at
org.apache.axis.encoding.DeserializationContextImpl.startElement(Deserializa
tionContextImpl.java:921)
at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
699)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:224)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:331)
at org.apache.axis.client.Call.invoke(Call.java:2200)
at org.apache.axis.client.Call.invoke(Call.java:2099)
at org.apache.axis.client.Call.invoke(Call.java:1622)
at
org.apache.wsif.providers.soap.apacheaxis.WSIFOperation_ApacheAxis.invokeAXI
SDocStyle(Unknown Source)
at
org.apache.wsif.providers.soap.apacheaxis.WSIFOperation_ApacheAxis.invokeReq
uestResponseOperation(Unknown Source)
at
org.apache.wsif.providers.soap.apacheaxis.WSIFOperation_ApacheAxis.executeRe
questResponseOperation(Unknown Source)
at com.vergil.wsif.WSIFDynClient.executeWebService(WSIFDynClient.java:95)
at com.vergil.wsif.WSIFDynClient.invokeWebService(WSIFDynClient.java:219)
at com.vergil.wsif.WSIFDynClient.main(WSIFDynClient.java:352)
I am not sure if its a bug or if there is something wrong with my code.
suresh