从 php 调用 dynamics ax soap 服务方法时出错
Error when calling dynamics ax soap service method from php
我有一个 PHP webapp 需要连接到 dynamics 365 ax soap 服务。
我得到了一个 wsdl url,我试图从那里获取值。
我曾经被禁止 error:608 现在我得到 HTTP 代码 400 错误请求
我正在验证、获取令牌并使用我的 POST 方法传递它
POST /soap/services/ webservice?wsdl HTTP/1.1
Host: domain.sandbox.ax.dynamics.com
Accept: text/xml
Connection:Keep-Alive
Content-type: text/xml
Authorization: Bearer tokenString
Soapaction: "http://tempuri.org/webservice/method"
Content-Length lengthOfXML
服务器响应:
HTTP/1.1 400 Bad Request Cache-Control: private Server:.. Strict-Transport-Security: max-age..; includeSubDomains Set-Cookie:ASP.NET_sessionId=.....;path=/;secure; HttpOnly Set-Cookie: ms-dyn-csrftoken:........ p3p: CP="No P3P policy defined. Read Microsoft privacy ... LinkID=271135" ..
//my XML that i pass as a curl POSTFIELD
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:i0="http://tempuri.org" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" >
<soap:Header>
<CallContext xmlns="schemas.microsoft.com/.../datacontracts">
<Company>some</Company>
<Language>en-us</Language>
<MessageId>0</MessageId>
<PartitionKey>286942</PartitionKey>
</CallContext>
</soap:Header>
<soap:Body>
<i0:nameofmethod >
<parameter>25536</parameter>
</i0:nameofmethod>
</soap:Body>
</soap:Envelope>
我至少需要获得某种值 HTTP 200 OK。我应该获得一个字符串数组。
我发现我的错误请求来自于在 XML 之前的 header 中添加了一个字符串。
在我搜索的其他论坛的一些答案中,他们建议在 XML 字符串本身之前添加 "xmlRequest=" 字符串,但我忘了我添加了它,这导致了问题。
我还用UTF代码删除了第一行字符串
<?xml version="1.0" encoding="utf-8" ?>
并直接添加肥皂信封。
我使用 SOAPUI 来帮助确保结构正确。
虽然我在调用我的方法时仍然遇到问题,但实际上有不同的错误
Forbidden 1317 System.ComponentModel.Win32Exception The specified account does not exist
我希望我能找到解决办法。有不同的 POST。
我有一个 PHP webapp 需要连接到 dynamics 365 ax soap 服务。
我得到了一个 wsdl url,我试图从那里获取值。
我曾经被禁止 error:608 现在我得到 HTTP 代码 400 错误请求
我正在验证、获取令牌并使用我的 POST 方法传递它
POST /soap/services/ webservice?wsdl HTTP/1.1
Host: domain.sandbox.ax.dynamics.com
Accept: text/xml
Connection:Keep-Alive
Content-type: text/xml
Authorization: Bearer tokenString
Soapaction: "http://tempuri.org/webservice/method"
Content-Length lengthOfXML
服务器响应:
HTTP/1.1 400 Bad Request Cache-Control: private Server:.. Strict-Transport-Security: max-age..; includeSubDomains Set-Cookie:ASP.NET_sessionId=.....;path=/;secure; HttpOnly Set-Cookie: ms-dyn-csrftoken:........ p3p: CP="No P3P policy defined. Read Microsoft privacy ... LinkID=271135" ..
//my XML that i pass as a curl POSTFIELD
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:i0="http://tempuri.org" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" >
<soap:Header>
<CallContext xmlns="schemas.microsoft.com/.../datacontracts">
<Company>some</Company>
<Language>en-us</Language>
<MessageId>0</MessageId>
<PartitionKey>286942</PartitionKey>
</CallContext>
</soap:Header>
<soap:Body>
<i0:nameofmethod >
<parameter>25536</parameter>
</i0:nameofmethod>
</soap:Body>
</soap:Envelope>
我至少需要获得某种值 HTTP 200 OK。我应该获得一个字符串数组。
我发现我的错误请求来自于在 XML 之前的 header 中添加了一个字符串。 在我搜索的其他论坛的一些答案中,他们建议在 XML 字符串本身之前添加 "xmlRequest=" 字符串,但我忘了我添加了它,这导致了问题。 我还用UTF代码删除了第一行字符串
<?xml version="1.0" encoding="utf-8" ?>
并直接添加肥皂信封。 我使用 SOAPUI 来帮助确保结构正确。
虽然我在调用我的方法时仍然遇到问题,但实际上有不同的错误
Forbidden 1317 System.ComponentModel.Win32Exception The specified account does not exist
我希望我能找到解决办法。有不同的 POST。