I'm trying to implement a soap mock service using SoapUI (v5.2.1). More specifically, I want to associate specific soap responses with specific requests. For example:
QUERY_MATCH configuration:
XPath:
declare namespace mynamespace1="http://my.namespace1.com/";
declare namespace mynamespace2="http://my.namespace2.com/xsd";
//mynamespace1:myrequest/cmd[1]/mynamespace2:myparam[1]
Expected Value:
12345
Dispatch to:
myMockResponse
Soap Request:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:mynamespace1="http://my.namespace1.com/" xmlns:mynamespace2="http://my.namespace2.com">
<soap:Header/>
<soap:Body>
<mynamespace1:myrequest>
<!--Optional:-->
<cmd>
<!--Optional:-->
<mynamespace2:id>1</mynamespace2:id>
<!--Optional:-->
<mynamespace2:myparam>12345</mynamespace2:myparam>
</cmd>
</mynamespace1:myrequest>
</soap:Body>
</soap:Envelope>
However, when I perform this request in SoapUI, I get the following response:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>Server</soap:Value>
</soap:Code>
<soap:Reason>
<!--1 or more repetitions:-->
<soap:Text xml:lang="en">Failed to find MockResponse</soap:Text>
</soap:Reason>
</soap:Fault>
</soap:Body>
</soap:Envelope>
can anyone tell me what I'm doing wrong? Thank you in advance for your help.
Best regards.
Related
I am getting the error
INCOMPATIBLE PARAMETERS ERROR Nested Exception : avax.xml.stream.XMLStreamException: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:p_orderdetailcode"
for the below structure
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:dat="http://ws.wso2.org/dataservice">
<soap:Header/>
<soap:Body>
<dat:hdhs_testdetail>
<dat:p_ordercode>1</dat:p_ordercode>
<!--1 or more repetitions:-->
<dat:p_orderdetailcodes>
<dat:p_orderdetailcode>11</dat:p_orderdetailcode>
<dat:p_orderdetailcode>12</dat:p_orderdetailcode>
</dat:p_orderdetailcodes>
</dat:hdhs_testdetail>
</soap:Body>
</soap:Envelope>
But it is working fine without nested "p_orderdetailcodes" like below
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:dat="http://ws.wso2.org/dataservice">
<soap:Header/>
<soap:Body>
<dat:hdhs_testdetail>
<dat:p_ordercode>1</dat:p_ordercode>
<!--1 or more repetitions:-->
<dat:p_orderdetailcode>11</dat:p_orderdetailcode>
<dat:p_orderdetailcode>12</dat:p_orderdetailcode>
</dat:hdhs_testdetail>
</soap:Body>
</soap:Envelope>
Below is my sample SOAP response.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns4:createReservationResponse xmlns:ns2="http://www.xyz2.com/documentation/createEnvironment/input" xmlns:ns3="http://webservices.xyz.com/documentation/reservations/createReservation/output" xmlns:ns4="http://webservices.xyz.com/documentation/reservations/createReservation/input" xmlns:ns5="http://webservices.xyz.com/documentation/reservations/cancelReservation/input" xmlns:ns6="http://webservices.xyz.com/documentation/reservations/cancelReservation/output">
<return>
<!-- response data -->
</return>
</ns4:createReservationResponse>
</soap:Body>
</soap:Envelope>
How do i remove unwanted namespaces here in my case xmlns:ns2, xmlns:ns4, xmlns:ns5 and xmlns:ns6. I should only keep xmlns:ns3 in the response.
What should i change in my wsdl so that i can get the expected response as below.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns4:createReservationResponse xmlns:ns3="http://webservices.xyz.com/documentation/reservations/createReservation/output">
<return>
<!-- response data -->
</return>
</ns4:createReservationResponse>
</soap:Body>
</soap:Envelope>
Please help me out from this.
Thanks in adv.
I'm trying to submit the request and get the response in SOAP UI but getting the following error.
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Body>
<SOAP:Fault>
<faultcode>SOAP:Server</faultcode>
<faultstring>Server Error</faultstring>
<detail>
<s:SystemError xmlns:s="http://sap.com/xi/WebService/xi2.0">
<context>XIAdapter</context>
<code>ADAPTER.JAVA_EXCEPTION</code>
<text>See log trace with id: n/a</text>
</s:SystemError>
</detail>
</SOAP:Fault>
</SOAP:Body>
</SOAP:Envelope>
The request i'm sending is
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:seg="http://intel.com/xi/Intel-MDM/Project/Segment">
<soapenv:Header/>
<soapenv:Body>
<seg:ListSegment_Request>
<!--Optional:-->
<SegmentName></SegmentName>
<!--Optional:-->
<StatusCode></StatusCode>
<!--Optional:-->
<PendingInd></PendingInd>
<!--Optional:-->
<ChangeDateFrom></ChangeDateFrom>
<!--Optional:-->
<ChangeTimeFrom></ChangeTimeFrom>
<!--Optional:-->
<ChangeDateTo></ChangeDateTo>
<!--Optional:-->
<ChangeTimeTo></ChangeTimeTo>
<!--Optional:-->
<List>
<!--Zero or more repetitions:-->
<Item>
<SegmentIdentifier>?</SegmentIdentifier>
</Item>
</List>
</seg:ListSegment_Request>
</soapenv:Body>
</soapenv:Envelope>
Is the issue with server or SOapUI or am i missing something here?
I'm testing a webservice thats based on CXF
I've added the following to the Soap header:
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-EFE11D3CEA7EFDCC4A14488809292421">
<wsse:Username>abc</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">edfewdw</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">AmAK2EvHMZWobr6KBJ4nOA==</wsse:Nonce>
<wsu:Created>2015-11-30T10:55:29.240Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
But inspite of this I'm getting the following soap fault
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>General security error (WSSecurityEngine: No password callback supplied)</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Any suggesstions?
You need to define a CallbackHandler implementation on the receiving side, to validate the password. There are some examples here if you are using CXF: http://cxf.apache.org/docs/ws-security.html
I'm trying to add a role using the WSO2 GReg admin service addRole using SoapUI. Unfortunately I get an error.
Using the following request I get the error "java.lang.ArrayIndexOutOfBoundsException: 3":
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:mgt="http://mgt.user.carbon.wso2.org">
<soap:Header/>
<soap:Body>
<mgt:addRole>
<!--Optional:-->
<mgt:addRole>test</mgt:addRole>
</mgt:addRole>
</soap:Body>
</soap:Envelope>
Using the following request I get the error "Role name not valid. Role name must be a non null string with following format, ^[^~!#$;%^*+={}\|\\<>,\'\"]{3,30}$":
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:mgt="http://mgt.user.carbon.wso2.org">
<soap:Header/>
<soap:Body>
<!--Optional:-->
<mgt:addRole>test</mgt:addRole>
</soap:Body>
</soap:Envelope>
Any idea's what I'm doing wrong?
Regards, nidkil
Can you try with the following Envelope?
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:mgt="http://mgt.user.carbon.wso2.org">
<soap:Header/>
<soap:Body>
<mgt:addRole>
<mgt:roleName>test</mgt:roleName>
</mgt:addRole>
</soap:Body>
</soap:Envelope>