Why does SOAPUI return bad request? - soap

I have created a soapui project to test this wsdl
When sending this request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:x/="http://www.w3schools.com/xml/">
<soapenv:Header/>
<soapenv:Body>
<x/:CelsiusToFahrenheit>
<!--Optional:-->
<x/:Celsius>30</x/:Celsius>
</x/:CelsiusToFahrenheit>
</soapenv:Body>
I get bad request in raw response
HTTP/1.1 400 Bad Request
Cache-Control: private,public
Content-Type: text/xml; charset=utf-8
Date: Sun, 28 Feb 2016 17:33:28 GMT
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Content-Length: 0

The error is so trivial due to the special character in the namespace (x/), which can be found by Validating the request( clicking keys 'Alt+v` in the request editor)
Could not figure it out that why such special character is coming when soapUI generates the request
What should be done in order to make the request valid?
Please change the request to below(replaced x/ to x):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:x="http://www.w3schools.com/xml/">
<soapenv:Header/>
<soapenv:Body>
<x:CelsiusToFahrenheit>
<x:Celsius>30</x:Celsius>
</x:CelsiusToFahrenheit>
</soapenv:Body>
</soapenv:Envelope>
Below is the screen shot of successful response upon changing the request as above.

Related

SOAP Request Error (The requested operation was rejected)

I sent a request via postman and it works fine and received a response, but in other environment I received an error message as below.
Url as e.g. https://URL/secure?Username=ABCD&Password=ABCD
Header:
Content-Type: text/xml
Accept: application/json, text/xml, application/xml, */*, application/soap+xml
User-Agent: APP
Accept-Encoding: gzip, deflate, br
SOAPAction: URL
Username: ABCD
Password: ABCD
ClientID: 123
OrgUnitGuid: abc-1234
OrgUnitID: 123
Body as example:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:post="url" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:core="http://Core.Model" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>ABCD</wsse:Username>
<wsse:Password>ABCD</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<----->
<-------->
</------->
</--------->
</soapenv:Body>
</soapenv:Envelope>
Response Body:
Connection=close
Pragma=no-cache
Content-Length=359
Cache-Control=no-cache
Content-Type=text/xml; charset=utf-8
<?xml version='1.0' encoding='utf-8'?><soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>The requested operation was rejected. Please consult with your administrator.Your support ID is: 17985204652528471489</faultstring><detail/></soap:Fault></soap:Body></soap:Envelope>
in "Accept-Encoding: gzip, deflate, br" I remove the br and it works but with another error as below :
Connection=close
Content-Length=311
Content-Type=text/html; charset=us-ascii
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request</h2>
<hr><p>HTTP Error 400. The request is badly formed.</p>
</BODY></HTML>
I edited the Header as follow and it works fine.
some headers are extra and there is no need for most of them
Accept-Encoding:gzip, deflate
SOAPAction: URL
Content-Type: text/xml

QuickBooks Web Connector - Can't find SOAP response

I'm trying to build a SOAP server to interact with the QuickBooks Web Connector, but can't find any examples of what the SOAP response to it's request to authenticate should be.
How do we respond to this?
I tried to find a way to response this action, but there is no document or example.
{'soapaction': '"http://developer.intuit.com/authenticate"', 'host': 'api:3000', 'user-agent': 'Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.42000)', 'content-type': 'text/xml; charset=utf-8', 'cookie': None, 'content-length': '382', 'ssl-client-verify': 'NONE', 'x-forwarded-for': '12.34.567.89', 'x-real-ip': '12.34.567.89', 'anvil-host': 'Jeremiah.QB.app'}
WSDL
You can find a WSDL for this service at the link below, which may help you develop:
https://test.developer.intuit.com/QBWC/TroubleshootWebServiceFS/Service.asmx?wsdl
Example SOAP request
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV: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/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<authenticate xmlns="http://developer.intuit.com/">
<strUserName xsi:type="xsd:string">username</strUserName>
<strPassword xsi:type="xsd:string">password</strPassword>
</authenticate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Example SOAP response for a VALID login
HTTP/1.1 200 OK
Date: Sat, 02 May 2009 17:45:48 GMT
Server: Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l DAV/2 PHP/5.2.9
X-Powered-By: PHP/5.2.9
Content-Length: 416
Connection: close
Content-Type: text/xml
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://developer.intuit.com/">
<SOAP-ENV:Body>
<ns1:authenticateResponse>
<ns1:authenticateResult>
<ns1:string>15c9ce293bd3f41b761c21635b14fa06</ns1:string>
<ns1:string></ns1:string>
</ns1:authenticateResult>
</ns1:authenticateResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Example SOAP response for an INVALID login
HTTP/1.1 200 OK
Date: Sat, 02 May 2009 17:43:09 GMT
Server: Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l DAV/2 PHP/5.2.9
X-Powered-By: PHP/5.2.9
Content-Length: 387
Connection: close
Content-Type: text/xml
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://developer.intuit.com/">
<SOAP-ENV:Body>
<ns1:authenticateResponse>
<ns1:authenticateResult>
<ns1:string></ns1:string>
<ns1:string>nvu</ns1:string>
</ns1:authenticateResult>
</ns1:authenticateResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Source:
authenticate: http://wiki.consolibyte.com/wiki/doku.php/quickbooks_web_connector_soap_authenticate
all of the other Web Connector SOAP methods: http://wiki.consolibyte.com/wiki/doku.php/quickbooks_web_connector#array_authenticate_string_strusername_string_strpassword

Fiddler doesn't capture SOAP Action

How do we find the SOAP action in fiddler:-
I captured the text view of the request. It doesn't show the request SOAP action:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><a:Security soap:mustUnderstand="1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:a="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><a:UsernameToken wsu:Id="UsernameToken-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><a:Username>LP_DEALIO#SERVICES</a:Username><a:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">Abc.1234</a:Password></a:UsernameToken></a:Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Get__CompIntfc__LP_PC_PROJECT_GEN xmlns="http://xmlns.oracle.com/Enterprise/Tools/schemas/M676402.V1"><BUSINESS_UNIT>US001</BUSINESS_UNIT><PROJECT_ID>LM202017</PROJECT_ID></Get__CompIntfc__LP_PC_PROJECT_GEN></s:Body></s:Envelope>
The SOAP Action is found in the Headers Section in Fiddler. Something like this:-
POST /PSIGW/PeopleSoftServiceListeningConnector/PSFT_EP/CI_LP_PC_PROJECT_GEN.1.wsdl HTTP/1.1
Content-Type: text/xml; charset=utf-8
VsDebuggerCausalityData: uIDPo+YluAuf3g9BhNp2nGC57WUAAAAA60+5s/MerUGZDfyhBXBAgPyLh3Vk3hZMrWvRTb0KntcACQAA
SOAPAction: "CI_LP_PC_PROJECT_GEN_UP.V1"
Host: psf92extigw.am.jll.com
Content-Length: 1039
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

Postman HTTP Status 400 - why?

I want to consume a SOAP Webservice from Dynamics NAV 2013 R2 via
http://servername:7047/DynamicsNAV71/WS/CRONUS%20AG/Codeunit/WSInterface
I can visit this page only via Chrome and it asks me for credentials (which are correct and working).
If I'm logged with Crome and start Postman I'm able to consume it:
POST /DynamicsNAV71/WS/CRONUS%20AG/Codeunit/WSInterface HTTP/1.1
Host: servername:7047
Content-Type: text/xml
SOAPAction: urn:microsoft-dynamics-schemas/codeunit/WSInterface:Process
Cache-Control: no-cache
Postman-Token: 5e640ab7-d0af-a098-0665-da4fa281f892
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsin="urn:microsoft-dynamics-schemas/codeunit/WSInterface">
<soapenv:Header/>
<soapenv:Body>
<wsin:Process>
<wsin:request>INPUT</wsin:request>
<wsin:response>FAKE_RESPONSE</wsin:response>
</wsin:Process>
</soapenv:Body>
</soapenv:Envelope>
and get statuscode 200 OK as response.
As soon, as I close the Chrome browser and send the request again I get the Status 401 (Unauthorized), so I add the Authorization header. After that I get the Status 400 with following headers:
POST /DynamicsNAV71/WS/CRONUS%20AG/Codeunit/WSInterface HTTP/1.1
Host: servername:7047
Content-Type: text/xml
SOAPAction: urn:microsoft-dynamics-schemas/codeunit/WSInterface:Process
Authorization: NTLM YWNhbVxncnU6Z3J1MTIzNA==
Cache-Control: no-cache
Postman-Token: 595777b7-5183-38d3-d49b-6bc5d4e3d30e
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsin="urn:microsoft-dynamics-schemas/codeunit/WSInterface">
<soapenv:Header/>
<soapenv:Body>
<wsin:Process>
<wsin:request>INPUT</wsin:request>
<wsin:response>FAKE_RESPONSE</wsin:response>
</wsin:Process>
</soapenv:Body>
</soapenv:Envelope>
Nothing changed beside the Authorization header, so why do I get the Status 400? Can somebody help?
If I'm logged in with Chrome the Authorization header doesn't matter if sent or not...
NTLM authentication is not supported by postman, you can use Fiddler or your chrome browser for authentication. https://github.com/postmanlabs/postman-app-support/issues/1137

How to get a SOAP fault message to be WS-I compliance

I have this message
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>LOGIN-ERR:Incorrect password - user could not be logged in.</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Schema validated fine, but the SOAP UI tool, when click on "Check WS-I Compliance", it gives a failed status with BP1305 assertion fail. I can't find what 1305 is and this is the detailed message
Result
failed
Failure Detail Message
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Date: Thu, 22 Jul 2010 20:41:43 GMT
Set-Cookie: JSESSIONID=C9D19FE6AAD89DFCB6BA9FE196E08D40; Path=/
Content-Type: text/xml;charset=utf-8
Server: Apache-Coyote/1.1
Element Location:
lineNumber=26
The problem seems to be that you are returning a SOAP Fault message, but with a HTTP status code of 200, SOAP Faults are required to be sent with a HTTP status code of 500.
You are missing the detail element in your fault message. It is a required element if the wsdl fault is produced as a results of the contents of the body element in the request
The message should be like this (detail element should contain application specific info. But it is acceptable to be empty. Not acceptable to be missing):
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>LOGIN-ERR:Incorrect password - user could not be logged in.</faultstring>
<detail></detail>
</soapenv:Fault>