Postman HTTP Status 400 - why? - soap

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

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

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

Why does SOAPUI return bad request?

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.

Fiddler soap action in proxy client

This is what fiddler has to say for a request I am trying to make to an external webservice
Request:
POST https://service100.emedny.org:9047/MHService HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Host: service100.emedny.org:9047
Content-Length: 7933
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Response: HTTP 500 Internal server error.
Miscellaneous: X-backside-transport: FAIL FAIL
TextView: Faultcode-Rejected by policy from client
Could soap Action =”” be the probable cause of this Faultcode? I am sure a client handshake was established
Now this is the trace viewer svclog
THank you

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>