I'm using JBossWS 1.0.3 to develop message style web services and have a question concerning the IN/OUT parameters of the message endpoint.
I'm trying to follow the example from the user guide (Chapter 3) and have developed several endpoints, each of which takes a SOAPElement as an
input argument and also returns a SOAPElement to the caller. In the WSDL, which I mostly wrote by hand, the message names for the input
and output parameters are all mapped to type "xsd:anyType". I would have thought that this would allow me to call the methods with any raw
XML message (wrapped in a SOAPElement of course), but this does not appear to be the case. The problem is that bacause the wsdl mapping
actually contains a message "name", JBossWS seems to expect that the message I return to be defined as an element with the same name.
In other words, I can't return two different messages from the same
endpoint, which is something that I could do using the older WS4EE Axis based material.
Here are the relevant parts of the wsdl and the jaxrpc-mapping files:
<types> <xsd:schema targetNamespace='http://scte.org/dvs629/msg' xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns='http://scte.org/dvs629/msg' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> <xsd:element name="AvailRequest" type="xsd:anyType"/> <xsd:element name="ServiceError" type="xsd:anyType"/> </xsd:schema> </types> <message name='ADSMessageServer_processAvailRequest'> <part element='tns:AvailRequest' name='request' /> </message> <message name='ADSMessageServer_processAvailRequestResponse'> <part element='tns:AvailResponse' name='response' /> </message> <portType name='ADSMessageServer'> <operation name='processAvailRequest'> <input message='tns:ADSMessageServer_processAvailRequest'/> <output message='tns:ADSMessageServer_processAvailRequestResponse'/> </operation> </portType> <binding name='ADSMessageServerBinding' type='tns:ADSMessageServer'> <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/> <operation name='processAvailRequest'> <soap:operation soapAction=''/> <input> <soap:body use='literal' namespace="http://scte.org/dvs629/msg" /> </input> <output> <soap:body use='literal' namespace="http://scte.org/dvs629/msg" /> </output> </operation> </binding>
And from the jaxrpc-mapping file:
<service-endpoint-method-mapping> <java-method-name>processAvailRequest</java-method-name> <wsdl-operation>processAvailRequest</wsdl-operation> <method-param-parts-mapping> <param-position>0</param-position> <param-type>javax.xml.soap.SOAPElement</param-type> <wsdl-message-mapping> <wsdl-message xmlns:wsdlMsgNS='http://scte.org/dvs629/msg'>wsdlMsgNS:ADSMessageServer_processAvailRequest</wsdl-message> <wsdl-message-part-name>request</wsdl-message-part-name> <parameter-mode>IN</parameter-mode> </wsdl-message-mapping> </method-param-parts-mapping> <wsdl-return-value-mapping> <method-return-value>javax.xml.soap.SOAPElement</method-return-value> <wsdl-message xmlns:wsdlMsgNS='http://scte.org/dvs629/msg'>wsdlMsgNS:ADSMessageServer_processAvailRequestResponse</wsdl-message> <wsdl-message-part-name>response</wsdl-message-part-name> </wsdl-return-value-mapping> </service-endpoint-method-mapping>
What I want to be able to do is to return a ServiceError element in place of an AvailRequest element under certain conditions, which may not be
error conditions. What happens when I try this is that JBossWS throws an exception and complains that the "Content root name does not match element name",
i.e. the stack expected to see an element of type AvailRequest but was presented with a ServiceError instead.
So, how to proceed? I really want to be able to use a single web-service endpoint and have that endpoint accept and return any raw XML document
that I choose to send in. Any help would be greatly appreciated.