-
1. Re: JAXB Transformer for document/literal wrapped SOAP
rcernich Jan 31, 2013 6:13 PM (in response to calvinchu101)This is a shot in the dark, but when you configured the soap binding on the promoted servce did you check "Unwrapped Payload"?
-
2. Re: JAXB Transformer for document/literal wrapped SOAP
calvinchu101 Jan 31, 2013 6:34 PM (in response to rcernich)It turns out adding <soap:messageComposer unwrapped="true"/> in the binding configuration, I tried both true and false value and JAXB transform failed in both cases
-
3. Re: JAXB Transformer for document/literal wrapped SOAP
mageshbk Feb 1, 2013 2:11 AM (in response to calvinchu101)can SwitchYard ignore the operation name in the SOAP body for document/literal wrapped style ? Thanks!
From the description here it seem to say exactly that https://issues.jboss.org/browse/SWITCHYARD-809.
It turns out adding <soap:messageComposer unwrapped="true"/>
What is the error message that you get when this is set to true? Could you enable trace logging using this handler in your config
<domain> <handlers> <handler class="org.switchyard.handlers.MessageTrace" name="MessageTrace"/> </handlers> </domain>
-
4. Re: JAXB Transformer for document/literal wrapped SOAP
calvinchu101 Feb 1, 2013 8:52 AM (in response to mageshbk)Thanks for your reply. Please find below the message trace when <soap:messageComposer unwrapped="true"/>
------- Begin Message Trace -------
Service -> {urn:switchyard-quickstart:transform-jaxb:1.0}OrderService
Operation -> submitOrder
Phase -> IN
State -> OK
Exchange Context ->
Message Context ->
org.switchyard.messageId : 328d66db-d41f-4fad-800c-624ea68ba74d
org.switchyard.contentType : {urn:switchyard-quickstart:transform-jaxb:1.0}submitOrder
org.switchyard.soap.messageName : submitOrder
Message Content ->
<?xml version="1.0" encoding="UTF-8"?><order>
<orderId>1</orderId>
<itemId>2</itemId>
<quantity>3</quantity>
</order>
------ End Message Trace -------
08:29:53,673 INFO [org.switchyard.handlers.MessageTrace] (http--0.0.0.0-8080-1)
------- Begin Message Trace -------
Service -> {urn:switchyard-quickstart:transform-jaxb:1.0}OrderService
Operation -> submitOrder
Phase -> OUT
State -> FAULT
Exchange Context ->
org.switchyard.exchangeDurationMS : 32
org.switchyard.exchange.transaction.beforeInvoked : true
Message Context ->
org.switchyard.relatesTo : 328d66db-d41f-4fad-800c-624ea68ba74d
org.switchyard.messageId : d6424234-7c0b-49d7-9f8c-053709275cdf
Message Content ->
org.switchyard.HandlerException: org.switchyard.exception.SwitchYardException: Failed to unmarshall for 'java:org.switchyard.quickstarts.transform.jaxb.Order'.
--- Caused by org.switchyard.exception.SwitchYardException: Failed to unmarshall for 'java:org.switchyard.quickstarts.transform.jaxb.Order'.
--- Caused by javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"order"). Expected elements are <{urn:switchyard-quickstart:transform-jaxb:1.0}order>,<{urn:switchyard-quickstart:transform-jaxb:1.0}orderAck>
------ End Message Trace -------
Here is the SOAP message sent from SoapUI
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:switchyard-quickstart:transform-jaxb:1.0">
<soapenv:Header/>
<soapenv:Body>
<urn:submitOrder>
<!--Optional:-->
<order>
<orderId>1</orderId>
<itemId>2</itemId>
<quantity>3</quantity>
</order>
</urn:submitOrder>
</soapenv:Body>
</soapenv:Envelope>
From the message trace, it was complainting that order should be under namespace {urn:switchyard-quickstart:transform-jaxb:1.0}order, so, I changed the SOAP request as below,
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:switchyard-quickstart:transform-jaxb:1.0">
<soapenv:Header/>
<soapenv:Body>
<urn:submitOrder>
<urn:order>
<orderId>1</orderId>
<itemId>2</itemId>
<quantity>3</quantity>
</urn:order>
</urn:submitOrder>
</soapenv:Body>
</soapenv:Envelope>
And it works ! But I am expecting the client would generate their own classes with the WSDL as standard WS and I am not able to enfore the format of the SOAP request. Does SwitchYard able to propagate the namespace to child node when a message is unwrapped ? Or there is something we can do in the JAXB annotation / ObjectFactory ?
I have my project src attached, only change is adding name in the @XmlType for Order and OrderAck object (otherwise WSDL won't generate) and changing {urn:switchyard-quickstart:transform-jaxb:1.0}order to {urn:switchyard-quickstart:transform-jaxb:1.0}submitOrder in jaxb tranform. Thank you very much !
-
transform-jaxb.zip 32.5 KB
-
-
5. Re: JAXB Transformer for document/literal wrapped SOAP
calvinchu101 Feb 1, 2013 3:09 PM (in response to calvinchu101)I get it working by removing the package-info.java so the JAXB can unmarshal the SOAP message,
my SOAP request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:switchyard-quickstart:transform-jaxb:1.0">
<soapenv:Header/>
<soapenv:Body>
<urn:submitOrder>
<!--Optional:-->
<order>
<orderId>1</orderId>
<itemId>2</itemId>
<quantity>3</quantity>
</order>
</urn:submitOrder>
</soapenv:Body>
</soapenv:Envelope>
and getting response
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<submitOrder xmlns="urn:switchyard-quickstart:transform-jaxb:1.0">
<ns2:submitOrderResponse xmlns:ns2="urn:switchyard-quickstart:transform-jaxb:1.0">
<orderId>1</orderId>
<accepted>true</accepted>
<status>Order Accepted</status>
</ns2:submitOrderResponse>
</submitOrder>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
However, from SoapUI the expected response format is
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:switchyard-quickstart:transform-jaxb:1.0">
<soapenv:Header/>
<soapenv:Body>
<urn:submitOrderResponse>
<!--Optional:-->
<orderAck>
<orderId>?</orderId>
<accepted>?</accepted>
<status>?</status>
</orderAck>
</urn:submitOrderResponse>
</soapenv:Body>
</soapenv:Envelope>
Looks like the XmlRootElement <orderAck> is missing during the marshalling, anything wrong with the JAXB annotations ?
-
6. Re: JAXB Transformer for document/literal wrapped SOAP
kcbabo Feb 4, 2013 2:34 PM (in response to calvinchu101)There's a bug in the unwrap logic in SOAP message composer *and* an issue with JAXB unmarshaling that impacts doc-lit wrapped (the transform "to" definition is assumed to be the root element name). Would you mind filing a JIRA and we'll get this fixed up in 0.8? Unfortuantely, this means that response messages using the unwrap feature of SOAP gateway with JAXB transformers will not work in 0.7. As a workaround, you could use a Java transformer and handle the JAXB unmarshaling yourself for the return message. That will only be necessary in 0.7 though - this will be fixed for 0.8.
thanks,
keith
-
7. Re: JAXB Transformer for document/literal wrapped SOAP
kcbabo Feb 4, 2013 2:37 PM (in response to kcbabo)Since it was fresh in my mind, I went ahead and created the JIRA:
-
8. Re: JAXB Transformer for document/literal wrapped SOAP
kcbabo Feb 7, 2013 1:43 PM (in response to kcbabo)The fix for this has been pushed and is available in the latest nightly build (0.8.0-SNAPSHOT).