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>
Related
My xml data:
xml_payload =
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<Authentication >
<username>blabla</username>
<password>123456789</password>
</Authentication>
</soap:Header>
<soap:Body>
<data>
<title>Test title</title>
<content>Test body format</content>
</data>
</soap:Body>
</soap:Envelope>
My request in django project:
try:
url = "http://someurls.com"
res = requests.post(url=url, data=xml_payload, headers={'Content-type': 'application/xml'})
return response.content, response.status_code
except Exception as e:
print(e)
return None, 500
When i hit the request using postman then i get response is given bellow:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Error reading XMLStreamReader.</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>'
It returns an error. I am surfing around the internet but didn't find any answer which is fulfilled my query.
Try to pass the xml payload as follows:
xml_payload = """<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<Authentication >
<username>blabla</username>
<password>123456789</password>
</Authentication>
</soap:Header>
<soap:Body>
<data>
<title>Test title</title>
<content>Test body format</content>
</data>
</soap:Body>
</soap:Envelope>"""
Afterd days, i finally found the answer. When i create a xml payload by python then python invisibly add "\n" at the end of every line. So when i replaced those "\n" then i works perfectly.
xml_payload = xml_payload.replace("\n", "")
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 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.
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