WSO2 ESB how to identify the request soap version - wso2

I need to return the soapfault accoding to the request soap version (1.1 or 1.2). I use ESB 4.8. Is there a simple way to identify the soap version? Can be automated the proper custom response fault according to the request?
Regards

you can filter the messages based on the namespace used for the versions.
SOAP 1.1 : http://schemas.xmlsoap.org/soap/envelope/
SOAP 1.2 : http://www.w3.org/2003/05/soap-envelope
i.e:
<filter xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xpath="/soapenv:Envelope ">
With that configuration, you can filter and get SOAP 1.1 requests. More information can be find here

Related

How to specify #XmlValue correctly in json object with loopback library?

I want to send the following soap xml fragment to IBM MDM Soap service using IBM loopback library version 3.22.
<ns2:InquiryParam xmlns:ns2="http://www.ibm.com/mdm/schema">
<ns2:tcrmParam name="PartyId">12345</ns2:tcrmParam>
<ns2:tcrmParam name="PartyType">P</ns2:tcrmParam>
<ns2:tcrmParam name="InquiryLevel">0</ns2:tcrmParam>
</ns2:InquiryParam>
I am trying to use IBM loopback javascript library v 3.22, to send SOAP request to IBM MDM web service. I have an example soap request that I can test successfully using Soap UI. I can see the exact soap request that loopback library is sending to the IBM MDM web server and the response from the server.
javascript model object in loopback v3.22 has the following javascript fragment.
let tmpVar = {"tcrmParam":[{"value":"12345","name":"PartyId"},{"value":"P","name":"PartyType"},{"value":"0","name":"InquiryLevel"}]};
let partyParam={RequestControl: RequestControl, InquiryParam: tmpVar};
Getparty.getParty(partyParam, function (err, response) {
...
The above javascript code fragment when used with loopback library sends the following xml fragment to IBM MDM Soap web service.
<soap:Body>
<ns1:getParty xmlns:ns1="http://www.ibm.com/mdm/port/Party">
<ns2:RequestControl xmlns:ns2="http://www.ibm.com/mdm/schema">
<ns2:requestID>1</ns2:requestID>
<ns2:DWLControl>
<ns2:requesterName>mdmadmin</ns2:requesterName>
<ns2:requesterLocale>en</ns2:requesterLocale>
</ns2:DWLControl>
</ns2:RequestControl>
<ns2:InquiryParam xmlns:ns2="http://www.ibm.com/mdm/schema">
<ns2:tcrmParam name="PartyId">
<value>12345</value>
</ns2:tcrmParam>
<ns2:tcrmParam name="PartyType">
<value>P</value>
</ns2:tcrmParam>
<ns2:tcrmParam name="InquiryLevel">
<value>0</value>
</ns2:tcrmParam>
</ns2:InquiryParam>
</ns1:getParty>
</soap:Body>
The error from IBM MDM Soap service is:
"ErrorMessage": "The required field is missing.",
The generated soap request must NOT have <value> in tcrmParam.
What changes are need in the loopback nodejs javascript project, so that soap connector will send xml fragment
<ns2:tcrmParam name="PartyId">12345</ns2:tcrmParam>
instead of
<ns2:tcrmParam name="PartyId">
<value>12345</value>
</ns2:tcrmParam>
?
Thx,
After reading strong soap docs, I noticed I can make use of $attributes and $value, as shown below:
let partyParam={RequestControl: RequestControl, InquiryParam: {tcrmParam: [{'$attributes': {name: 'PartyId'}, '$value': '12345'},
{'$attributes': {name: 'PartyType'}, '$value': 'P'},
{'$attributes': {name: 'InquiryLevel'}, '$value': '0'}]}};
With the above code change, I was able to verify the following soap request was getting generated and the soap request completed successfully.
<ns2:InquiryParam xmlns:ns2="http://www.ibm.com/mdm/schema">
<ns2:tcrmParam name="PartyId">12345</ns2:tcrmParam>
<ns2:tcrmParam name="PartyType">P</ns2:tcrmParam>
<ns2:tcrmParam name="InquiryLevel">0</ns2:tcrmParam>
</ns2:InquiryParam>
Thx,

Error sending MTOM request to WSO2 ESB

I'm using wso2 ESB in order to mediate request from a client to a web service, but I can't send MTOM attachments. ESB replies with error "Mime parts not found".
The sample MTOMSwASampleService give me same error too.
Can anyone help me? How can I send MTOM attachments through ESB?
Try preserving Content-type header and see.
Add the following property to repository/conf/passthru-http.properties file.
http.headers.preserve=Content-Type

Does WSO2 ESB works on soap 1.1 by default?

I just want to know that does WSO2 ESB by default support on soap 1.1? How to make it work on soap 1.2? Is there any global property by which I can change all the deployed services to make it work on soap 1.2?
Thanks in Advance
Regards,
Shri
Hi Thanks for your response. but I get below error when try 1.2 Soap request from the SOAP UI.
[2016-08-10 10:53:41,744] ERROR - NativeWorkerPool [msg_id=urn:uuid:4abc1b45-c6a8-4f92-9559-169d3dab403f] Uncaught exception
org.apache.axiom.om.impl.exception.OMBuilderException: detail unsupported element in SOAPFault element
at org.apache.axiom.soap.impl.builder.SOAP12BuilderHelper.handleEvent(SOAP12BuilderHelper.java:175)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:428)
WSO2 ESB supports both by default. For example, when you create a proxy service in ESB, it exposes both SOAP 1.1 and SOAP 1.2 endpoints.
It seems that this error happens when using SOAP 1.2 while communicating between .Net applications and Axis2. So far the only solution I have seen is to force the use of SOAP 1.1.
See also:
Mention of error
Apparently the definition of the SOAPfault changed slightly between versions, most importantly the capitalisation of certain elements, including the detail element. The error suggests that the received message includes the element, which is in accordance with SOAP 1.1, while in SOAP 1.2 it should be a element. For more detail, check this site

How to turn off Envelope and Body in SOAP request

This is critical to my current project. I have written a client in C++ using Windows web services. This client talks to the Clickatell SMS SOAP web service. I have tested the request using the SOAPUI tool and get correct response. I also receive the SMS message. Now, when I do this programmatically it fails because the WsCall() [in the code generated from WSDL via wsutil.exe) inserts even though the SOAP request I have already includes Envelope and Body. I cannot take out my Envelope since I have namespace specified in it like this:
http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:tns=\"soap.clickatell.com\">
I know that the additional Envelope and Body are inserted since I see it in the Fiddler tool.
Any help I can get is highly appreciated!
Looks like you are using the older type rpc/encoded soap api.
Have you tried using the document/literal service?
(http://api.clickatell.com/soap/document_literal/webservice.php?wsdl)

WSO2 - ESB server 4.7 Hangs- when an invalid json format is given as input for rest API

A REST API has been defined ESB. What we have observed is if the json format (invalid json),
the request is hanging and the server doesn't give any response. Ideally it should throw some
error at least and it should not hang.
I had the same situation in WSO2 4.8.1. Try to change JsonStreamBuilder in your axis2.xml to JsonBuilder from (org.apache.synapse.commons.json) or use your own implementation.