Does SOAP 1.2 support SOAP 1.1 version as well? - web-services

I am using soap 1.2 for my webservice application.
When I send a soap request using 1.2 namespace and content-type:application/soap+xml I get a successful response.
But when I send the request using 1.1 namespace and content-type:text/xml I get VersionMismatch error.
SOAP 1.1 namespace : http://schemas.xmlsoap.org/soap/envelope - Content-Type:text/xml
SOAP 1.2 namespace : http://www.w3.org/2003/05/soap-envelope - Content-Type:application/soap+xml
Below is the soap 1.1 request and response message.
1) Does my application support SOAP 1.1 version ?
(Because although I am using SOAP 1.2 when I send SOAP 1.1 request I get VersionMismatch but the fault string is misleading).
2) In case if there is backward compatibility ie SOAP 1.2 also supports SOAP 1.1 is there a way to disable this ?
SOAP 1.1 request:
<soap:Envelopexmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
</soap:Header>
<soap:Body>
</soap:Body>
</soap:Envelope>
SOAP 1.1 response:
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:VersionMismatch</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">Only SOAP 1.1 or SOAP 1.2 messages are supported in the system</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

Related

Consume SOAP web service using REST POST method

I want to consume a simple SOAP web service using REST technology. I've heard it can be achieved using POST method. Just adding some headers to the request. Is it possible? How to do that? Thanks a lot !!!
SOAP considers different information in the headers/body than REST does, but it's all HTTP:
# Headers
Content-Type: text/xml
SOAPAction: <SOAPAction here>
# Body
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >
<soapenv:Header>
.
</soapenv:Header>
<soapenv:Body>
.
.
.
</soapenv:Body>
</soapenv:Envelope>
You'll need to fill in the actual body with whatever the SOAP service expects (obviously) - that can be found in the WSDL if you don't have any sample requests available.
I found this blog post to be very helpful, even if you're making the call from some non-postman tool.

Unable to invoke WSO2 API Manager 1.10 admin services

I have enabled the admin services from carbon.xml for API Manager and extracted the wsdl successfully. Now I am trying to invoke the service RemoteTenantManagerService using SOAP UI. I have loaded the wsdl in SOAP UI and also provided the Basic authentication Username/Password as admin/admin. But I am getting following message back. Port for API Manager is Offset 1
Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.ws.um.carbon.wso2.org">
<soapenv:Header/>
<soapenv:Body>
<ser:getAllTenants/>
</soapenv:Body>
</soapenv:Envelope>
Response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>The service cannot be found for the endpoint reference (EPR) /services/RemoteTenantManagerService.RemoteTenantManagerServiceHttpsSoap11Endpoint</faultstring>
<detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
There are two types of transports, PassThrough and servlet. The admin services are exposed through servlet transport. Hence those must be invoked using servlet transport port.
For ex:- https://{host}:9443/services/RemoteTenantManagerService
In your case you have set offset to the "1" so please call the service using the URL https://{host}:9444/services/RemoteTenantManagerService
The generated WSDL contains the endpoint with Passthrough port hence soapUI shows it as the default endpoint. Please change the port to servlet port (your case it should be 9444) and run again.

Error in WSO2 ESB when calling service without Header element

I believe I found bug in WSO2 ESB.
I defined proxy service for our customer.
With security turned off I always get expected result, but when I enable security (scenario 1 - UsernameToken), then I get error "SOAP Envelope can not have children other than SOAP Header and Body".
I'm able to reproduce this bug with 'echo' service.
Here is request:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:echo="http://echo.services.core.carbon.wso2.org">
<soap:Body>
<echo:echoString>
<in>ABC</in>
</echo:echoString>
</soap:Body>
</soap:Envelope>
Turning security off or adding <soap:Header /> element before <soap:Body> element provides expected response again.
I'm using WSO2 ESB version 4.8.1, SoapUI 5.0.0 as client.
The SOAP headers contain application specific information related to the SOAP message. They typically contain routing information, authentication information, transaction semantics etc.
If you removed <soapenv:Header/> SoapUI will not send your user name and password to rampart.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:echo="http://echo.services.core.carbon.wso2.org">
<soapenv:Header/>
<soapenv:Body>
<echo:echoString>
<!--Optional:-->
<in>ABC</in>
</echo:echoString>
</soapenv:Body>
</soapenv:Envelope>
So your error was return by org.apache.axiom.soap.SOAPProcessingException due to AxisEngine System error.
When your sending request to secured one header is must..

WSO2 ESB how to identify the request soap version

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

SOAP web-service - fake a server side error?

my iphone app is using soap web-services. I want to know how it would behave if the web-service returns a soap error?
I am using charles (HTTP Proxy) to catch the responses and modify the response before sending it to my iPhone app. What I'm trying to do is to modify a successful soap response, and turn it into a soap fault to see how my application behave.
QUESTION: How does a SOAP error response look like? (With restful all i had to do was to change the responseCode to 504, how can I achieve this with SOAP)?
How does a SOAP error response look like?
Here's an example of how a failed SOAP response might look like:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header />
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring xml:lang="en-US">The creator of this fault did not specify a Reason.</faultstring>
<detail>
<MyFault xmlns="http://schemas.datacontract.org/2004/07/ToDD" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<MyProperty>some value</MyProperty>
</MyFault>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
As you can see there's a special <Fault> node in the body of the SOAP response which could contain any XML describing the SOAP fault. The custom XML should be in the <detail> child node.