SoapUI uses mesagename and not operationname in message - soap

I have a problem with a service wsdl that is delivered by a third party. Let my try to explain. Take this wsdl part:
<wsdl:portType name="IBestelService">
<wsdl:operation name="PlaatsOrder">
<wsdl:input message="tns:PlaatsOrderRequest"/>
<wsdl:output message="tns:PlaatsOrderResponse"/>
<wsdl:fault message="tns:BestelServiceFault" name="BestelServiceFault"/>
</wsdl:operation>
<wsdl:operation name="PlaatsOrderThreeShips">
<wsdl:input message="tns:PlaatsOrderRequestThreeShips"/>
<wsdl:output message="tns:PlaatsOrderResponseThreeShips"/>
<wsdl:fault message="tns:BestelServiceFault" name="BestelServiceFault"/>
</wsdl:operation>
</wsdl:portType>
For the request soapui (and .net to) generates the following request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sambo-ict:basetypes:1.0" xmlns:urn1="urn:sambo-ict:bestelservice:types:1.0">
<soapenv:Header>
<urn:AuthenticationHeader xmlns="urn:sambo-ict:basetypes:1.0"/>
</soapenv:Header>
<soapenv:Body>
<urn1:PlaatsOrderRequest>
<EAN>9789490998394</EAN>
<DistributorOrderId>13188</DistributorOrderId>
<DeliveryMethod>Tegoed</DeliveryMethod>
<Amount>1</Amount>
</urn1:PlaatsOrderRequest>
</soapenv:Body>
</soapenv:Envelope>
However the service at the third party site expects this
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sambo-ict:basetypes:1.0" xmlns:urn1="urn:sambo-ict:bestelservice:types:1.0">
<soapenv:Header>
<urn:AuthenticationHeader xmlns="urn:sambo-ict:basetypes:1.0"/>
</soapenv:Header>
<soapenv:Body>
<urn1:PlaatsOrder>
<EAN>9789490998394</EAN>
<DistributorOrderId>13188</DistributorOrderId>
<DeliveryMethod>Tegoed</DeliveryMethod>
<Amount>1</Amount>
</urn1:PlaatsOrder>
</soapenv:Body>
</soapenv:Envelope>
When I search the internet on soap. The "plaatsorder" instead of "plaatsorderrequest" seems to be the right way. However I do not believe that both soapui/java and .net have it wrong. So can anyone explain the difference to me?

The element:
<wsdl:input message="tns:PlaatsOrderRequest"/>
will have an associated message entry that looks like:
<wsdl:message name="PlaatsOrderRequest">
<wsdl:part element="urn1:PlaatsOrderRequest" name="parameters" />
</wsdl:message>
That element name is what dictates the wrapped request element, assuming this is a document/literal wrapped service (which they usually are). I would need the full WSDL and schema to be more definitive.

You can make this change by yourself in wsdl. It's easy just replace that tag whichever is required. It would work.
by the way you can directly ask your client by providing right wsdl with this change. It would be easy for them to generate wsdl with required request tag.

Related

WSO2 ESB Call SOAP Endpoint couldn't perform operation

I want to call SOAP endpoint URL with Action from WSO2 ESB. I could call the SOAP URL and getting entire wsdl response but i couldn't perform the Action.
Let say my wsdl respone
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions ....>
<wsdl:types>
<xs:schema ..>...</xs:schema>
</wsdl:types>
<wsdl:service>..</wsdl:service>
<wsdl:portType name="..">
<wsdl:operation name="AAA">
<wsdl:input message="tns:in"/>
<wsdl:output message="tns:out"/>
<wsdl:fault name="fault1" message="tns:Error"/>
</wsdl:operation>
<wsdl:operation name="BBB">
<wsdl:input message="tns:in"/>
<wsdl:output message="tns:out"/>
<wsdl:fault name="fault1" message="tns:Error"/>
</wsdl:operation>
<wsdl:operation name="CCC">
<wsdl:input message="tns:in"/>
<wsdl:output message="tns:out"/>
<wsdl:fault name="fault1" message="tns:Error"/>
</wsdl:operation>
......
......
</wsdl:portType>
...
This is my WSO2 ESB code to call SOAP Endpoint
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope
xmlns:app="...xsd"
xmlns:com=".....xsd"
xmlns:ser="...xsd" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<ser:...Request>
<app:ApplicationHeader>
<app:...>$1</app:...>
<app:...>$2</app:...>
</app:ApplicationHeader>
<ser:DataHeader>
<ser:....>$3</ser:...
<ser:...>$4</ser:...>
</ser:DataHeader>
</ser:...Request>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg value="1"/>
<arg value="2"/>
<arg value="3"/>
<arg value="4"/>
</args>
</payloadFactory>
<header name="Action" scope="default" value="AAA"/>
<call blocking="true">
<endpoint>
<address uri="http:/URL/>
</endpoint>
</call>
<respond/>
When I call this code, i will get above entire WSDL response instead of operation "AAA"
But I should get this operation
It looks like you specified wsdl url as an address of endpoint. That's why you receive wsdl file and an error that instead of Soap envelope it gets definitions.
You should use wsdl endpoint.
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="Service">
<wsdl uri="https://yourServer/yourService?wsdl" service="yourService" port="yourServiceSoap">
<suspendOnFailure>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</wsdl>
</endpoint>
Or you may use address endpoint, but take the URI from wsdl file in wsdl:port section,
for this example, take https://yourServer/service/yourService.asmx as an URI:
<service name="yourService">
<port name="yourServiceSoap" binding="yourServiceSoapBinding">
<soapbind:address location="https://yourServer/service/yourService.asmx"/>
</port>
</service>

Problems with SOAP/XML-RPC Request from Jmeter

I'm kind of new with this Jmeter thing and I'm trying to do a simple SOAP/XML-RPC request on Jmeter. I'm using an example code I found on internet, that seems to work pretty fine (at least using Wizlet in Chrome didn't seem to have a problem), but when I use the soap request that generates the plug-in on the element in Jmeter... Well thats a different story. If someone could tell me the problem it would be awesome.
This is the code of the WSDL:
<wsdl:definitions xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://jee.javapapers.com" xmlns:intf="http://jee.javapapers.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://jee.javapapers.com">
<!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)
-->
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://jee.javapapers.com">
<element name="animalType">
<complexType>
<sequence>
<element name="animal" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="animalTypeResponse">
<complexType>
<sequence>
<element name="animalTypeReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="animalTypeResponse">
<wsdl:part element="impl:animalTypeResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="animalTypeRequest">
<wsdl:part element="impl:animalType" name="parameters"/>
</wsdl:message>
<wsdl:portType name="AnimalTypeService">
<wsdl:operation name="animalType">
<wsdl:input message="impl:animalTypeRequest" name="animalTypeRequest"/>
<wsdl:output message="impl:animalTypeResponse" name="animalTypeResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AnimalTypeServiceSoapBinding" type="impl:AnimalTypeService">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="animalType">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="animalTypeRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="animalTypeResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AnimalTypeServiceService">
<wsdl:port binding="impl:AnimalTypeServiceSoapBinding" name="AnimalTypeService">
<wsdlsoap:address location="http://localhost:8082/WebServicesAnimals/services/AnimalTypeService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
And this is the request i'm sending and the response error.
URL: http://localhost:8082/WebServicesAnimals/services/AnimalTypeService?WSDL
BODY:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<animalType xmlns="http://jee.javapapers.com">
<animal>Lion</animal>
</animalType>
</soapenv:Body>
</soapenv:Envelope>
Response:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
<faultstring>no SOAPAction header!</faultstring>
<detail>
<ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">WBFINF05</ns2:hostname>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
I see at least 2 problems:
Why are you sending your request to the URL ending with ?WSDL, you should use:
http://localhost:8082/WebServicesAnimals/services/AnimalTypeService
Error says you don't have a SOAPAction. If you confirm you didn't set it, add a Header Manager and set soapAction to ""
Finally you should use regular HTTP REquest instead of SOAP/XML-RPC Request as per this tutorial:
https://jmeter.apache.org/usermanual/build-ws-test-plan.html

How does a SOAP WS know the requested operation?

Say my WSDL contains the following:
<message name="modifRequest">
<part name="siList" element="sn:siListElement"/>
</message>
<message name="modifResponse">
<part name="siList" element="sn:boolElement"/>
</message>
<portType name="siModificationPortType">
<operation name="delete">
<input message="tns:modifRequest" />
<output message="tns:modifResponse" />
</operation>
<operation name="update">
<input message="tns:modifRequest" />
<output message="tns:modifResponse" />
</operation>
</portType>
Which generates the following SOAP client message in SoapUI, whether in an update or a delete request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sim="simSchema">
<soapenv:Header/>
<soapenv:Body>
<sim:siListElement>
<!--1 or more repetitions:-->
<sim:si name="?" desc="?" workspace="workspace">
<!--Zero or more repetitions:-->
<sim:bp name="?" value="?" bps="?"/>
</sim:si>
</sim:siListElement>
So it seems that the only thing sent through HTTP to the WS is the siListElement. But how does the WS know the operation the client wants to reach (here, delete/update)? Especially in that case where the inputs of both operations have the same structure.
The WS know the operation through SOAPAction HTTP Header. When you create a new SOAP Test request in SOAPUI you have to select the operation and choosing it then SOAPUI automatically sets the operation for you request an maps this operation to the necessary SOAPAction which it will send as HTTP header when you run the test request.
This "magic" happens because in your WSDL surely there is also a information which you are missing in your question which is binding the wsdl:operation against soap:operation. In your WSDL probably there are something like:
<binding name="bindingDelete" type="siModificationPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="delete">
<soap:operation soapAction="delete"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<binding name="bindingAdd" type="siModificationPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="add">
<soap:operation soapAction="add"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
So when you specify to SOAPUI that your operation is delete then SOAPUI is sending SOAPAction http header with the correct value like for example delete, instead of you specify add operation then SOAPAction http header with some value like add is send.
You can check what I'm saying runing your request and clicking on the Raw tab on the left side of your SOAPRequest and checking the different SOAPAction values for your operation types:
Hope this helps,

Communicating to WSDL using SOAP, I don't know how to form correctly my SOAP to interact with the WSDL in a remote server

I have to make a request to a web service, that uses Axis2, I'm too close to have it working but i keep getting error messages and i'm sure it is in the construction of my SOAP XML. This was the SOAP:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header>
<RequestsoapHeader>
<spId>SPID</spId>
<spPassword>RandomPass</spPassword>
<timeStamp>20130115160251</timeStamp>
</RequestsoapHeader>
</soap:Header>
<soap:Body>
<operation>
<name>getSPToken</name>
<input>http://zzz.zzz.zzz.zzz/my/redirection/url/</input>
</operation>
</soap:Body>
</soap:Envelope>
UPDATE!!!! Now the soap is this:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header>
<RequestsoapHeader>
<spId>SPID</spId>
<spPassword>RandomPass</spPassword>
<timeStamp>20130115160251</timeStamp>
</RequestsoapHeader>
</soap:Header>
<soap:Body>
<getSPTokenRequest>
<SPredirectURL>http://zzz.zzz.zzz.zzz/my/redirection/url/</SPredirectURL>
</getSPTokenRequest>
</soap:Body>
</soap:Envelope>
The part i can't fix is the Body, i tried to call the operation in different ways, for example instead of <operation> i used <operation name="getSPToken">, i also tried not using operation and created a tag with the name: <getSPToken>, but nothing works.
This is the WSDL part that describes the operation i'm trying to call in the Web Service:
<wsdl:operation name="getSPToken">
<soap:operation soapAction="" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="ServiceException">
<soap:fault name="ServiceException" use="literal"/>
</wsdl:fault>
<wsdl:fault name="PolicyException">
<soap:fault name="PolicyException" use="literal"/>
</wsdl:fault>
</wsdl:operation>
UPDATE!!! This is the interface XML (part of the WSDL) that i didn't post before:
<wsdl:types>
<xsd:schema elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.csapi.org/schema/parlayx/sicoweb/v1_0/local">
<xsd:element name="getSPTokenRequest" type="osg_sicoweb_local_xsd:getSPTokenRequest"/>
<xsd:complexType name="getSPTokenRequest">
<xsd:sequence>
<xsd:element name="SPredirectURL"
type="xsd:string" maxOccurs="1" minOccurs="1">
<xsd:annotation>
<xsd:documentation></xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="getSPTokenResponse" type="osg_sicoweb_local_xsd:getSPTokenResponse"/>
<xsd:complexType name="getSPTokenResponse">
<xsd:sequence>
<xsd:element name="SPToken" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
And this is the response i was getting:
HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=UTF-8
Date: Tue, 15 Jan 2013 21:10:49 GMT
Connection: close
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault xmlns:axis2ns73="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode>axis2ns73:Client</faultcode>
<faultstring>The endpoint reference (EPR) for the Operation not found is http://xxx.xxx.xxx.xxx:xxx/path/to/service/ and the WSA Action = </faultstring>
<detail />
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
UPDATE!!!! With the new changes, the response i'm getting is this one:
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>org.apache.axis2.databinding.ADBException: Unexpected subelement getSPTokenRequest</faultstring>
<detail />
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
The operation getSPToken receives one parameter called SPredirectURL, that contains a URL of redirection, please help.
Try one of the following as your body:
<soap:Body>
<SPredirectURL>http://zzz.zzz.zzz.zzz/my/redirection/url/</SPredirectURL>
</soap:Body>
<soap:Body>
<getSPTokenRequest xmlns="http://www.csapi.org/schema/parlayx/sicoweb/v1_0/local">
<SPredirectURL>http://zzz.zzz.zzz.zzz/my/redirection/url/</SPredirectURL>
</getSPTokenRequest>
</soap:Body>
Based on the WSDL snippet, the web service endpoint is using the document/literal convention for messages, but without the WSDL message declarations it is unclear whether the 'bare' (first example) or 'wrapped' (second example) version is expected. The post at this address (http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/) gives good insight into the various dialects described by WSDL.
UPDATE:
Based on the schema inside the wsdl:types section, the fully-qualified name for the element expected by the service (based on the declared targetNamespace attribute of the schema element) is http://www.csapi.org/schema/parlayx/sicoweb/v1_0/local{getSPTokenRequest}
One way of establishing that name (inline namespace declaration) is shown in the updated second body above.
Post back with the next iteration.

Hand rolled SOAP request

I am trying to construct a hand rolled HTTP request in order to return a response from what I thought was a fairly simple SOAP web service call. However, I am having trouble constructing the request properly, and am not getting the response I expect.
Applicable wsdl statements:
wsdl Target Namespace:
targetNamespace="http://tempuri.org/"
wsdl Service
<wsdl:service name="TrackerService">
<wsdl:port name="BasicHttpBinding_ITrackerService" binding="tns:BasicHttpBinding_ITrackerService">
<soap:address location="http://mydomain.com/TrackerServiceSite/wctest2.TrackerService.svc"/>
</wsdl:port>
</wsdl:service>
wsdl Message
<wsdl:message name="ITrackerService_GetStub_InputMessage">
<wsdl:part name="parameters" element="tns:GetStub" />
</wsdl:message>
<wsdl:message name="ITrackerService_GetStub_OutputMessage">
<wsdl:part name="parameters" element="tns:GetStubResponse" />
</wsdl:message>
wsdl Binding and SOAP Operation
<wsdl:binding name="BasicHttpBinding_ITrackerService" type="tns:ITrackerService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
.
. <!—- Omitted for brevity -->
.
<wsdl:operation name="GetStub">
<soap:operation soapAction="http://tempuri.org/ITrackerService/GetStub" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
EXPECTED Return Response
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header />
<s:Body>
<GetStubResponse xmlns="http://tempuri.org/">
<GetStubResult xmlns:a=http://schemas.datacontract.org/2004/07/wctest2 xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:Password>SOMEPASS</a:Password>
<a:Username>SOMEUSER</a:Username>
</GetStubResult>
</GetStubResponse>
</s:Body>
</s:Envelope>
HTTP request thus far:
POST http://mydomain.com/TrackerServiceSite/wctest2.TrackerService.svc HTTP/1.1
Content-Type: text/xml; charset="utf-8"
Content-Length: 297
Host: mydomain.com
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetStub xmlns="http://tempuri.org/"/>
</soap:Body>
</soap:Envelope>
HTTP Response
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</faultcode>
<faultstring xml:lang="en-US">
The message with Action '' cannot be processed at the receiver, due to a
ContractFilter mismatch at the EndpointDispatcher. This may be because of
either a contract mismatch (mismatched Actions between sender and receiver)
or a binding/security mismatch between the sender and the receiver. Check
that sender and receiver have the same contract and the same binding
(including security requirements, e.g. Message, Transport, None).
</faultstring>
</s:Fault>
</s:Body>
</s:Envelope>
I am pretty sure that I need to include a soapAction from the wsdl file somewhere in my request, but I'm not sure where to include it. What else am I missing? Any help would be greatly appreciated.
Place your soap action in the SOAPAction HTTP header