MS Dynamics CRM error HTTP/1.1 400 Bad Request - web-services

I am trying to call Microsoft Dynamics CRM web service CustomBinding_IOrganizationService and the SOAPAction is Retrieve using SOAP UI
I am using NTLM authentication type
SOAPAction - http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Retrieve
Accept - application/xml, text/xml, */*
Content-Type - text/xml; charset=utf-8
Below is my xml request
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:con="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<soap:Header/>
<soap:Body>
<ser:Retrieve>
<!--Optional:-->
<ser:entityName>contact</ser:entityName>
<!--Optional:-->
<ser:id>B1180AE1-19F5-E011-820D-00505610126C</ser:id>
<!--Optional:-->
<ser:columnSet>
<!--Optional:-->
<con:AllColumns>false</con:AllColumns>
<!--Optional:-->
<con:Columns>
<!--Zero or more repetitions:-->
<arr:string>fullname</arr:string>
</con:Columns>
</ser:columnSet>
</ser:Retrieve>
</soap:Body>
</soap:Envelope>
I am getting below response
HTTP/1.1 400 Bad Request
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/html
Server: Microsoft-IIS/7.5 Microsoft-HTTPAPI/2.0
Persistent-Auth: true
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 07 May 2019 15:01:34 GMT
Bad Request
Can you please help me to correct where the issue is?

The issue has been resolved as the service was down during that period

Related

org.apache.cxf.transport.http.HTTPException: HTTP response '415: Unsupported Media Type'

I am trying to invoke o SOAP web service using an apache CXF client and the error above appears. I tried to fix this by using SOAP12HTTP_BINDING but then the following error occurs:
org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted
The outbound message is the folowing:
Address: myHostName
HttpMethod: POST
Content-Type: text/xml
ExchangeId: myExchangeId
ServiceName: myServiceName
PortName: myPortName
PortTypeName: DummyImpl
Headers: {SOAPAction="mySoapAction",
Accept=*/*, Host=myHost,
Accept-Encoding=gzip,deflate,
Content-Type=application/soap+xml;
charset=UTF-8;action="}
Payload: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="myNamespace">
<soapenv:Body>
<a:operatioName>
...
</a:operatioName>
</soapenv:Body>
</soapenv:Envelope>
Turns out the problem was the Content-Type header, i changed it to text/xml;charset=UTF-8 and it worked.

How to import text into postman

I am new to postman and am given what I believe is a postman export. I can manually add these fields into postman but is there a quicker way to import into postman? I tried to import in postman via raw text, but unrecognized format.
POST /WebService/WebService.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
Host: dev.helloworld.com
User-Agent: PostmanRuntime/7.28.4
Accept: */*
Postman-Token: f62e3cd8-91c0-4238-844c-592aeb19e0a3
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 596
<?xml version="1.0" encoding="utf-8"?>
<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>
<sDatabaseName>Apples</sDatabaseName>
</soap:Body>
</soap:Envelope>
That doesn't look like a Postman export.
That looks like a (raw) console log output.
A Postman export would be in JSON format.
The information you have would need to be input manually as you have described.
However, once it has been input, you could then export the collection you create (in JSON format) and you would have a copy that you can then re-import whenever you need to.
Alternatively, if you have the cURL command you could import that as raw text.

Error calling WSO2 API Manager Admin Servces via soapUI

I am experiencing an error calling WSO2 API Manager v2.1.0 Admin Services via soapUI. It seems that the requests that are changing state in API Manager like this one, addRole, are failing. Note that "read only" style requests like listAllUsers or getAllRolesNames are succeeding.
Here is the raw request from soapUI:
POST https://localhost:9443/services/UserAdmin.UserAdminHttpsSoap11Endpoint HTTP/1.1
Accept-Encoding: gzip,deflate
SOAPAction: "urn:addRole"
Authorization: Basic YWRtaW46YWRtaW4=
Content-Type: application/soap+xml
Content-Length: 283
Host: localhost:9443
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd">
<soapenv:Header/>
<soapenv:Body>
<xsd:addRole>
<xsd:roleName>test_role</xsd:roleName>
</xsd:addRole>
</soapenv:Body>
</soapenv:Envelope>
Here is the response form soapUI:
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</wsa:Action>
</soapenv:Header>
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:VersionMismatch</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">Transport level information does not match with SOAP Message namespace URI</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Here is the log entry that appears in wso2carbon.log:
[2017-03-03 16:23:03,474] ERROR - ResponseTimeCalculator wso2statistics.request.received.time is null in the IN MessageContext
Any help is greatly appreciated.
Thanks!
Looks like your request is a SOAP 1.1.
In that case, the Content-Type of the request should be text/xml, not application/soap+xml.
If that doesn't work, try using RemoteUserStoreManagerService instead of UserAdmin.

HTTP 401 Unauthorized error in sending GetItem Request

I'm using EWS GetItem operation to fetch data from exchange server, but i've got following error
Error 401 fault: SOAP-ENV:Server[no subcode]
"HTTP Error"
Detail: HTTP/1.1 401 Unauthorized
However my login credential are correct, since those are works well with findItem request and response, but when GetItem request goes to server it give above error. My credentials are like:
soap *pSoap = proxy->soap;
proxy->soap_endpoint = "https://outlook.office365.com/ews/exchange.asmx";
pSoap->userid = "abcd#abcd.onmicrosoft.com";
pSoap->passwd = "abcd1234";
And Received log are like
HTTP/1.1 200 OK
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/8.0
request-id: b66330dd-37a5-40c0-946f-12a204b2eacb
Set-Cookie: ClientId=OVJLSVEMECIIUMMAXM9JA; expires=Thu, 22-Sep-2016 18:00:57 GMT; path=/; secure; HttpOnly
X-CalculatedBETarget: SG2PR06MB1165.apcprd06.prod.outlook.com
X-BackEndHttpStatus: 200
Set-Cookie: exchangecookie=fa26578c8e659cf1ccc3f50b3a83; expires=Fri, 23-Sep-2016 18:00:58 GMT; path=/; HttpOnly
x-EwsHandler: FindItem
X-AspNet-Version: 4.0.30319
X-DiagInfo: SG2PR06MB1165
X-BEServer: SG2PR06MB1165
Set-Cookie: ClientId=OVJLSVEIIUMMAXM9JA; expires=Thu, 22-Sep-2016 18:00:57 GMT; path=/; secure; HttpOnly
X-Powered-By: ASP.NET
X-FEServer: SG2PR03CA0031
Date: Wed, 23 Sep 2015 18:00:58 GMT
Connection: close
17d
<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="268" MinorBuildNumber="21" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
1e8
</s:Header><s:Body><m:FindItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"><m:ResponseMessages><m:FindItemResponseMessage ResponseClass="Success"><m:ResponseCode>NoError</m:ResponseCode><m:RootFolder TotalItemsInView="2" IncludesLastItemInRange="true"><t:Items><t:Message><t:ItemId Id="
edAQAfAGNvObtNFsAAAA==" ChangeKey="CQfwjm7TRbAAAAAAWl"/></t:Message><t:Message><t:ItemId Id="
133AQAfAGCObtNFsAAAIFUAAAAA==" ChangeKey="CQAAABYAAACZNImAAAAAWT"/></t:Message></t:Items></m:RootFolder></m:FindItemResponseMessage></m:ResponseMessages></m:FindItemResponse>
</s:Body></s:Envelope>
/* This below log for getItem Request*/
HTTP/1.1 401 Unauthorized
Server: Microsoft-IIS/8.0
request-id: 7a1a654c-fa72-46b0-ab76-a6045c576d9f
Set-Cookie: ClientId=H8THXUH0BECF9HJMTXHEW; expires=Thu, 22-Sep-2016 18:01:01 GMT; path=/; secure; HttpOnly
X-Powered-By: ASP.NET
X-FEServer: SG2PR03CA0003
WWW-Authenticate: Basic Realm=""
Date: Wed, 23 Sep 2015 18:01:00 GMT
Connection: close
Content-Length: 0
What could be possibly wrong here, why one request pass and another fail? any idea? thank you.
I got it!!, it's error occurs just because of my second request not able to login on the exchange server. since i've provided my credentials only once, So when findItem Response come, connection with the server is 'closed' and my next subsequent request not able to login. so i've to login once again to the server.

Invoke wso2 admin services SOAPUI

I m working on wso2 admin services. I get url as http://localhost:9763/services/AuthenticationAdmin?wsdl for AuthencticationAdmin.
Now, when I hit the login operation, with admin,admin,127.0.0.1, I get true as return.
ESB console shows logged in.
Now, when I hit logout operation, I dont get any response.
Also I notice that header of the response does not contain any session ID.
My ESB is 4.6.0.
login request :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aut="http://authentication.services.core.carbon.wso2.org">
<soapenv:Header/>
<soapenv:Body>
<aut:login>
<!--Optional:-->
<aut:username>admin</aut:username>
<!--Optional:-->
<aut:password>admin</aut:password>
<!--Optional:-->
<aut:remoteAddress>127.0.0.1</aut:remoteAddress>
</aut:login>
</soapenv:Body>
</soapenv:Envelope>
login response :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:loginResponse xmlns:ns="http://authentication.services.core.carbon.wso2.org">
<ns:return>true</ns:return>
</ns:loginResponse>
</soapenv:Body>
</soapenv:Envelope>
In the response, when I hit login I see, at bottom I only get 6 elements in header as follows :
> Date Tue, 25 Jun 2013 14:31:42 GMT
> Transfer-Encoding chunked
> #status# HTTP/1.1 200 OK
> Content-Type text/xml; charset=UTF-8
> Connection Keep-Alive
> Server WSO2-PassThrough-HTTP
Now, I dont get session ID. Can you please point out where m I going wrong?
My scenario is that I want to login to WSO2 and then hit some other admin service operation.
After some time debugging with the java client (see my other answer), I noticed that the SOAPUI Endpoint was not using the 9443 port that I was using in the Java client. See the image below.
The 8243 port was picked up from the WSDL by SOAPUI.
When I changed the SOAP UI Endpoint port from 8243 to 9443, the JSESSIONID gets returned in the response, as seen below:
HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=573D42750DE6C0A287E1582239EB5847; Path=/; Secure; HttpOnly
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Wed, 26 Jun 2013 22:14:20 GMT
Server: WSO2 Carbon Server
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns:loginResponse xmlns:ns="http://authentication.services.core.carbon.wso2.org"><ns:return>true</ns:return></ns:loginResponse></soapenv:Body></soapenv:Envelope>
I have no idea what the difference is between the ports 8243 and 9443, or why one returns a JSESSIONID and the other doesn't.
You could try accessing the server using a java client. There is an example here. You could try this example and dump out the SOAP message to see the difference against what you are seeing in SOAPUI.
I'm wondering if the example axis client's setManageSession(true) does some magic on the session:
public static void main(String[] args) throws
RemoteException, AuthenticationAdminAuthenticationExceptionException {
System.setProperty("javax.net.ssl.trustStore",
SampleConstants.CLIENT_TRUST_STORE_PATH);
System.setProperty("javax.net.ssl.trustStorePassword",
SampleConstants.KEY_STORE_PASSWORD);
System.setProperty("javax.net.ssl.trustStoreType",
SampleConstants.KEY_STORE_TYPE);
AuthenticationAdminStub stub =
new AuthenticationAdminStub(
"https://localhost:9443/services/AuthenticationAdmin");
ServiceClient client = stub._getServiceClient();
Options options = client.getOptions();
options.setManageSession(true);
Login login = new Login();
login.setUsername("admin");
login.setPassword("admin");
stub.login(login);
ServiceContext serviceContext = stub.
_getServiceClient().getLastOperationContext().getServiceContext();
String sessionCookie = (String) serviceContext
.getProperty(HTTPConstants.COOKIE_STRING);
System.out.println(sessionCookie);
}
The above code prints out something similar to the following:
JSESSIONID=844ECBED015805A24FF9DBD5F5A56C8D; Path=/; Secure=null; HttpOnly=null