Is there a way to see te entire SOAP Envelop while developing a proxy message flow on OSB? I was thinking about using a Log action, but envelope is not a context variable. Is there a way to build it? Thx.
It is true that SOAP envelope is not a context variable when a SOAP message reaches Proxy.
You can rebuild the SOAP Envelope using following expression but change the namespace according to SOAP version. Assign it to a variable and log it after
For v1.2
<env:Envelope xmlns:env="https://www.w3.org/2003/05/soap-envelope">
<env:Header>
{$header/*}
</env:Header>
<env:Body>
{if ($fault) then ($fault) else ($body/*)}
</env:Body>
</env:Envelope>
Related
I wanna send message to the MQ with SOAP format but in exchange object i'll get only XML Data (without envelope,header and body), here i have to append the SOAP envelope and body to the exchange object as like below.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:act="http://ei/event/envprocess">
<soapenv:Header/>
<soapenv:Body>
**// exchange object get the xml data need to add here.**
</soapenv:Body>
</soapenv:Envelope>
for solution i found this link but i'm not getting how to get the cxf:cxfEndpoint object in spring boot and how to append payload or exchange data for it.
Can anyone please help me to resolve this issue.
As mentioned in the comment, you can use XSL to transform your message body into a SOAP request.
To call the XSL in the route is a one-liner:
.to("xslt:MyStylesheet.xsl?saxon=true")
This expects the MyStylesheet.xsl in the classpath root. If you want to leverage XSL 2, add the Saxon dependency and the option saxon=true.
If you only need XSL 1, you don't need Saxon and the option.
The solution you found would be to establish a SOAP communication through a JMS broker. In this scenario, MQ mimics a synchronous request/reply communication. This is a quite different subject than using standard MQ (asychronous sender and receiver).
If the simple XSL or SOAP over JMS better suits you case depends on the broader goal you want to reach.
I am trying to call soap web service from camel rest, from java DSL. but getting server error with 500 response code.
I will receive call from a rest with json data and i have to make call to a third party soap service also i need to process the soap response and send back the response in json formate.
here is my code
{
String getCustomerDetailsurl="http://<serverip>/webservice/Service.asmx?op=GetClientDetail&bridgeEndpoint=true";
rest("/customers")
.description("Aviva Mobile sales customer service")
.consumes("application/json")
.produces("application/json")
.post().type(ClientRequest.class) // incomming request data
.route()
.from("direct:start")
//.setHeader(Exchange.HTTP_METHOD, constant("POST"))
.process(new CustomerProcessor()).marshal().xstream()
.to(getCustomerDetailsurl);
Error
org.apache.camel.http.common.HttpOperationFailedException: HTTP operation failed invoking http://<serverip>/webservice/Service.asmx?op=GetClientDetail with statusCode: 500
at org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:239) ~[camel-http-2.17.5.jar:2.17.5]
at org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:161) ~[camel-http-2.17.5.jar:2.17.5]
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) ~[camel-core-2.17.5.jar:2.17.5]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145) ~[camel-core-2.17.5.jar:2.17.5]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) ~[camel-core-2.17.5.jar:2.17.5]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468) ~[camel-core-2.17.5.jar:2.17.5]
}
You have to look at Server side for what actual error is.
You may use some tool like tcp monitor (tcpMon) to see exactly what you send and what you get back.
Actually, To use SOAP service it is much better to use SOAP client, rather than raw call through http. Take a look at Camel-CXF component. Then create a CXF endpoint and use it uri in your .to({cxfEndpointUri}). CXF will do all SOAP work for you. Maybe you will need to make a little work in its interceptors, like authorization if Server requires it.
P.S. In your code what kind of Exchange.body your CustomerProcessor produces? is it a valid for server SOAP Envelope? does it have all what server requires by its contract (WSDL)?
I am trying to consume my service class of salsforce SOAP API in SOAPUI.
Getting the error
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>'false' is not a valid value for the enum 'LogCategory'</faultstring>
</soapenv:Fault>
What should be specific value in
<pay:categories>
<pay:category>false</pay:category>
<pay:level></pay:level>
</pay:categories>
<pay:debugLevel></pay:debugLevel>
from this page it looks like pay:category has to be one of
Db
Workflow
Validation
Callout
Apex_code
Apex_profiling
All
I'm trying to integrate with the SOAP API specified here:
https://api.okpay.com/OkPayAPI?singleWsdl
https://api.okpay.com/OkPayAPI?wsdl
At the moment the code autogenerated from the wsdl files appears to be acting up, so I'm wondering what should be the correct envelope to send and where should I be sending it?
I used this service for testing: http://www.soapclient.com/soapmsg.html . For server address I put in:
https://api.okpay.com/
And for SOAP Message I put in what my code is currently generating:
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Body xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Get_Date_Time xmlns="https://api.okpay.com"></Get_Date_Time></Body></Envelope>
And the response appears to be a HTML code of a page, rather than an envelope response.
What would be the correct SOAP Action / Message to what Server Address to send in order to invoke the Get_Date_Time method as specified in the WSDL?
A couple of things:
The "Server Address" needs to point at the actual service, so in this case
https://api.okpay.com/OkPayAPI
The action can be seen in the WSDL, in this case
https://api.okpay.com/I_OkPayAPI/Get_Date_Time
Have a look at the WSDL and search for the action I gave above, that should give you an idea for how to find it for other actions.
With those two updates you should get back the response you expect:
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<Get_Date_TimeResponse xmlns="https://api.okpay.com">
<Get_Date_TimeResult>2015-01-31 17:52:37</Get_Date_TimeResult>
</Get_Date_TimeResponse>
</s:Body>
</s:Envelope>
I have been trying to invoke a rest operation from my wso2 ESB and was successful in invoking the rest post method from WSO2 ESB. But, un luckily i was not able to access the data that i posted, neither through request parameters nor through request attributes.
PS: I don't want to frame a get kind of URLs for my post request.
is there a solution to this ?
You need to use the correct content type so it will preserve POST request data.This post will help you to understand the reason.
Edit.
1) Add the following entry to axis2.xml in message builders.
<messageBuilder contentType="application/x-www-form-urlencoded"
class="org.apache.synapse.commons.builders.XFormURLEncodedBuilder"/>
2) then access the required parameter in esb using
<property name="NameOfTheProperty" expression="//xformValues/NameOfTheProperty/text()"/>