You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Ekta Wadhwani <ek...@gmail.com> on 2016/03/30 16:35:03 UTC

How to process Multipart SOAP response

Hi Camel team,


Jboss Fuse Studio : Version: 8.1.0.GA

Jdk version: 1.8.0_73

Using XML DSL

No server involved. since i am yet trying to run camel context locally on
dev studio


I am trying to connect send and receive a SOAP request&response message
to a third party webservice(Oracle).

I am succesfully able to send and receive. However i am not able to process
the soap response received since its a multipart messasge as follows:

*SOAP response 1st :* ------=_Part_4694_423702238.1459343682692
Content-Type: application/xop+xml;charset=UTF-8;type="text/xml"
Content-Transfer-Encoding: 8bit
Content-ID: <44e5cd34-e05d-41d2-8231-e3e23f2440a1>

<?xml version="1.0" encoding="UTF-8" ?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsa="http://www.w3.org/2005/08/addressing"><env:Header><wsa:Action>
http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService//ErpIntegrationService/uploadFileToUcmResponse</wsa:Action><wsa:MessageID>urn:uuid:46417381-5e12-448d-968f-0e8e824a1828</wsa:MessageID></env:Header><env:Body><ns0:uploadFileToUcmResponse
xmlns:ns0="
http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/"><result
xmlns="
http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/
">111837</result></ns0:uploadFileToUcmResponse></env:Body></env:Envelope>
------=_Part_4694_423702238.1459343682692--


*[           default-workqueue-3] route7                         INFO  SOAP
response 4th :* ------=_Part_4706_434840889.1459343688908
Content-Type: application/xop+xml;charset=UTF-8;type="text/xml"
Content-Transfer-Encoding: 8bit
Content-ID: <e0946c95-9d0d-40ba-8416-0528bfcb4aa9>

<?xml version="1.0" encoding="UTF-8" ?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsa="http://www.w3.org/2005/08/addressing"><env:Header><wsa:Action>
http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService//ErpIntegrationService/downloadESSJobExecutionDetailsResponse</wsa:Action><wsa:MessageID>urn:uuid:82d7d264-ef7f-41da-8d51-79e940413b13</wsa:MessageID></env:Header><env:Body><ns0:downloadESSJobExecutionDetailsResponse
xmlns:ns0="
http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/"><ns2:result
xmlns:ns2="
http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/"
xmlns:ns1="http://xmlns.oracle.com/adf/svc/types/" xmlns:ns0="
http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="ns0:DocumentDetails"><ns0:Content><xop:Include xmlns:xop="
http://www.w3.org/2004/08/xop/include"
href="cid:51e0b71c-160b-4921-a8a7-8fe7f87ccc3b"/></ns0:Content><ns0:FileName
xsi:nil="true"/><ns0:ContentType>zip</ns0:ContentType><ns0:DocumentTitle>ESS_L_157463</ns0:DocumentTitle><ns0:DocumentAuthor>G4S.Integration.User</ns0:DocumentAuthor><ns0:DocumentSecurityGroup>Attachments</ns0:DocumentSecurityGroup><ns0:DocumentAccount
xsi:nil="true"/><ns0:DocumentName>157463.zip</ns0:DocumentName><ns0:DocumentId
xsi:nil="true"/></ns2:result></ns0:downloadESSJobExecutionDetailsResponse></env:Body></env:Envelope>
------=_Part_4706_434840889.1459343688908
Content-Transfer-Encoding: binary
Content-ID: <51e0b71c-160b-4921-a8a7-8fe7f87ccc3b>

PK157463.log�XKS�8��W������jTL�  .. blah blah some binary content
------=_Part_4706_434840889.1459343688908--


I am using below XML DSL code:

<dataFormats>
<soapjaxb
contextPath="com.oracle.xmlns.apps.financials.commonmodules.shared.model.erpintegrationservice.types"
elementNameStrategyRef="elStrategy" id="soapFormat" />
</dataFormats>

<route streamCache="true">
<from ... />
<bean ref="erpintservice" method="prepareDocumentDetails" />
<marshal ref="soapFormat" />
<setHeader headerName="Authorization">
<constant>Basic ZzRzLmludGVncmF0aW9uLnVzZXI6RnVzaW9uQDEyMw==</constant>
</setHeader>
<!-- <log message="SOAP Request : ${body}"/> -->
<to
uri="cxf:bean:uploadFileToUcmEndpoint?defaultOperationName=uploadFileToUcm&amp;dataFormat=MESSAGE"
/>

<log message="SOAP response 1st : ${body}" />
...</route></cameContext>
<bean id="elStrategy"
class="org.apache.camel.dataformat.soap.name.ServiceInterfaceStrategy">
<constructor-arg
value="com.oracle.xmlns.apps.financials.commonmodules.shared.model.erpintegrationservice.ErpIntegrationService"/>
<constructor-arg value="true"/>
</bean>

Marshalling works fine since i can see my webservice call has been invoked
and response coming back. unmarshalling would obviously not work directly
since the message is not a pure soap msg but A multipart message

I checked online for mime multipart data format however i do not see any
example of xml DSL + i could not use it in my jboss dev studio since it
does not have this dataformat at all (dont know why)

My objectives:
1. to be able to process/ fetch out the soap envelope part from this
multipart soap response using XML DSL
2. to be able to process the binary content of multipart message since that
is my attachment using XML DSL.

Request you all to help. Badly stuck at this point
Thanks,
Ekta

Re: How to process Multipart SOAP response

Posted by Ekta Wadhwani <ek...@accenture.com>.
Hi Greg,

I am using XML DSL to configure the CXF component.
There isnt much online help for XML DSL for CXF_MESSAGE configuration for
processing soap attachments.
Below is my current configuration with dataformat as MESSAGE.
camel-context file:
 <dataFormats> 
 <soapjaxb 

contextPath="com.oracle.xmlns.apps.financials.commonmodules.shared.model.erpintegrationservice.types" 
 elementNameStrategyRef="elStrategy" id="soapFormat" /> 
 </dataFormats> 
 
 <route streamCache="true"> 
 <from ... /> 
 <bean ref="erpintservice" method="prepareDocumentDetails" /> 
 <marshal ref="soapFormat" /> 
 <setHeader headerName="Authorization"> 
 <constant>Basic ZzRzLmludGVncmF0aW9uLnVzZXI6RnVzaW9uQDEyMw==</constant> 
 </setHeader> 
  
 <to 
 

uri="cxf:bean:uploadFileToUcmEndpoint?defaultOperationName=uploadFileToUcm&amp;dataFormat=MESSAGE" 
 /> 
 
 <log message="SOAP response 1st : ${body}" /> 
 ...</route></cameContext> 
<bean id="elStrategy" 
class="org.apache.camel.dataformat.soap.name.ServiceInterfaceStrategy"> 
<constructor-arg
value="com.oracle.xmlns.apps.financials.commonmodules.shared.model.erpintegrationservice.ErpIntegrationService"/> 
<constructor-arg value="true"/> 
</bean>


camel-cxf file:

<cxf:cxfEndpoint id="uploadFileToUcmEndpoint"
address="https://fin-aufsn4x0cba.oracleoutsourcing.com:443/publicFinancialCommonErpIntegration/ErpIntegrationService"
wsdlURL="src/main/resources/ERP1.wsdl"
serviceClass="com.oracle.xmlns.apps.financials.commonmodules.shared.model.erpintegrationservice.ErpIntegrationService"
xmlns:ssp="http://xmlns.oracle.com/oxp/service/v2">
<cxf:properties>
<entry key="dataFormat" value="MESSAGE" />
</cxf:properties>
</cxf:cxfEndpoint>

In this above confguration if i change dataformat from Message to
CXF_MESSAGE, i am getting below error:
default-workqueue-1] PhaseInterceptorChain          WARN  Interceptor for
{http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/}ErpIntegrationServiceService#{http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/}uploadFileToUcm
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary:
------=_Part_3434_428158164.1459969427807
	at
org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:60)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:784)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1644)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1155)
	at
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428)
	at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353)
	at java.lang.Thread.run(Thread.java:745)


I am using XML DSL hence i cannot use anything like message.getSOAPPart()
directly.. i need to know what shud b its corrosponding XML DSL.
Basically any sample example/documentation of CXF_MESSAGE using XML DSL
shall help. if you can assist?

Thanks,
Ekta




--
View this message in context: http://camel.465427.n5.nabble.com/How-to-process-Multipart-SOAP-response-tp5780046p5780619.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to process Multipart SOAP response

Posted by Gregoire Autric <ga...@redhat.com>.
hi Ekta,

I think if you change your dataformat to CXF_MESSAGE it should work fine

please follow URL doc http://camel.apache.org/cxf.html

CXF_MESSAGE Mode: MTOM is supported, and Attachments can be retrieved by
Camel Message APIs mentioned above. Note that when receiving a multipart
(i.e. MTOM) message the default SOAPMessage to String converter will
provide the complete multipart payload on the body. If you require just the
SOAP XML as a String, you can set the message body with
message.getSOAPPart(), and Camel convert can do the rest of work for you.


Best Regards, Bien à vous,  どうぞお元気で,
____________________________________________________
Greg AUTRIC
- JBoss Middleware Consultant -
- Red Hat France -


On Wed, Mar 30, 2016 at 4:35 PM, Ekta Wadhwani <ek...@gmail.com>
wrote:

> Hi Camel team,
>
>
> Jboss Fuse Studio : Version: 8.1.0.GA
>
> Jdk version: 1.8.0_73
>
> Using XML DSL
>
> No server involved. since i am yet trying to run camel context locally on
> dev studio
>
>
> I am trying to connect send and receive a SOAP request&response message
> to a third party webservice(Oracle).
>
> I am succesfully able to send and receive. However i am not able to process
> the soap response received since its a multipart messasge as follows:
>
> *SOAP response 1st :* ------=_Part_4694_423702238.1459343682692
> Content-Type: application/xop+xml;charset=UTF-8;type="text/xml"
> Content-Transfer-Encoding: 8bit
> Content-ID: <44e5cd34-e05d-41d2-8231-e3e23f2440a1>
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:wsa="http://www.w3.org/2005/08/addressing"><env:Header><wsa:Action>
>
> http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService//ErpIntegrationService/uploadFileToUcmResponse
> </wsa:Action><wsa:MessageID>urn:uuid:46417381-5e12-448d-968f-0e8e824a1828</wsa:MessageID></env:Header><env:Body><ns0:uploadFileToUcmResponse
> xmlns:ns0="
>
> http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/
> "><result
> xmlns="
>
> http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/
> ">111837</result></ns0:uploadFileToUcmResponse></env:Body></env:Envelope>
> ------=_Part_4694_423702238.1459343682692--
>
>
> *[           default-workqueue-3] route7                         INFO  SOAP
> response 4th :* ------=_Part_4706_434840889.1459343688908
> Content-Type: application/xop+xml;charset=UTF-8;type="text/xml"
> Content-Transfer-Encoding: 8bit
> Content-ID: <e0946c95-9d0d-40ba-8416-0528bfcb4aa9>
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:wsa="http://www.w3.org/2005/08/addressing"><env:Header><wsa:Action>
>
> http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService//ErpIntegrationService/downloadESSJobExecutionDetailsResponse
> </wsa:Action><wsa:MessageID>urn:uuid:82d7d264-ef7f-41da-8d51-79e940413b13</wsa:MessageID></env:Header><env:Body><ns0:downloadESSJobExecutionDetailsResponse
> xmlns:ns0="
>
> http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/
> "><ns2:result
> xmlns:ns2="
>
> http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/
> "
> xmlns:ns1="http://xmlns.oracle.com/adf/svc/types/" xmlns:ns0="
>
> http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/
> "
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="ns0:DocumentDetails"><ns0:Content><xop:Include xmlns:xop="
> http://www.w3.org/2004/08/xop/include"
>
> href="cid:51e0b71c-160b-4921-a8a7-8fe7f87ccc3b"/></ns0:Content><ns0:FileName
>
> xsi:nil="true"/><ns0:ContentType>zip</ns0:ContentType><ns0:DocumentTitle>ESS_L_157463</ns0:DocumentTitle><ns0:DocumentAuthor>G4S.Integration.User</ns0:DocumentAuthor><ns0:DocumentSecurityGroup>Attachments</ns0:DocumentSecurityGroup><ns0:DocumentAccount
>
> xsi:nil="true"/><ns0:DocumentName>157463.zip</ns0:DocumentName><ns0:DocumentId
>
> xsi:nil="true"/></ns2:result></ns0:downloadESSJobExecutionDetailsResponse></env:Body></env:Envelope>
> ------=_Part_4706_434840889.1459343688908
> Content-Transfer-Encoding: binary
> Content-ID: <51e0b71c-160b-4921-a8a7-8fe7f87ccc3b>
>
> PK      157463.log�XKS�8 ��W����� �j T L�   .. blah blah some binary
> content
> ------=_Part_4706_434840889.1459343688908--
>
>
> I am using below XML DSL code:
>
> <dataFormats>
> <soapjaxb
>
> contextPath="com.oracle.xmlns.apps.financials.commonmodules.shared.model.erpintegrationservice.types"
> elementNameStrategyRef="elStrategy" id="soapFormat" />
> </dataFormats>
>
> <route streamCache="true">
> <from ... />
> <bean ref="erpintservice" method="prepareDocumentDetails" />
> <marshal ref="soapFormat" />
> <setHeader headerName="Authorization">
> <constant>Basic ZzRzLmludGVncmF0aW9uLnVzZXI6RnVzaW9uQDEyMw==</constant>
> </setHeader>
> <!-- <log message="SOAP Request : ${body}"/> -->
> <to
>
> uri="cxf:bean:uploadFileToUcmEndpoint?defaultOperationName=uploadFileToUcm&amp;dataFormat=MESSAGE"
> />
>
> <log message="SOAP response 1st : ${body}" />
> ...</route></cameContext>
> <bean id="elStrategy"
> class="org.apache.camel.dataformat.soap.name.ServiceInterfaceStrategy">
> <constructor-arg
>
> value="com.oracle.xmlns.apps.financials.commonmodules.shared.model.erpintegrationservice.ErpIntegrationService"/>
> <constructor-arg value="true"/>
> </bean>
>
> Marshalling works fine since i can see my webservice call has been invoked
> and response coming back. unmarshalling would obviously not work directly
> since the message is not a pure soap msg but A multipart message
>
> I checked online for mime multipart data format however i do not see any
> example of xml DSL + i could not use it in my jboss dev studio since it
> does not have this dataformat at all (dont know why)
>
> My objectives:
> 1. to be able to process/ fetch out the soap envelope part from this
> multipart soap response using XML DSL
> 2. to be able to process the binary content of multipart message since that
> is my attachment using XML DSL.
>
> Request you all to help. Badly stuck at this point
> Thanks,
> Ekta
>