I'm trying (very hard) to implement a SOAP client for the MDGP using a couple of PHP libraries, as a means to synchronize information with PHP services.
From what I could infer from the basic documentation (focused on Microsoft developers only) and sparse Google results (should I use Bing instead?), I included WSA headers, then implemented NTLM, then saw the GP server doesn't like the way cURL handles NTLM and took it out, and moved into WSSE authentication.
However, I still receive the same response as usual (when one response even comes, as faulty XML usually yields an empty and generic 400 response): BadContextToken, mentioning the action (taken from the Native WSDL file) could be wrong, or the security context token could be invalid or expired.
Currently, this is the list of additional "features" I'm packing on my XML payload, transported through plain HTTP:
- WSA header with action, to, message-id and reply-to
- WSSE with username, password digest, nonce and created timestamp
Would someone knowledgeable on the SOAP dialect used by MDGP be able to verify what's wrong with my request? Here follows a sample XML (stripped of server address and other sensitive data):
POST /Dynamics/GPService/GPService HTTP/1.1 Host: xyz-server.com:48620 Content-Length: 1596 Content-Type: application/soap+xml; charset="utf-8"; action="schemas.microsoft.com/.../GetCustomerList" <?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="www.w3.org/.../soap-envelope" xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:ns1="schemas.datacontract.org/.../Microsoft.Dynamics.Common" xmlns:ns2="schemas.datacontract.org/.../Microsoft.Dynamics.GP" xmlns:ns3="schemas.microsoft.com/.../01" xmlns:wsa="www.w3.org/.../addressing"> <env:Header> <wsa:Action>schemas.microsoft.com/.../GetCustomerList</wsa:Action> <wsa:To>xyz-server.com/.../GPService</wsa:To> <wsa:MessageID>uuid:72ce1a62-40e3-e3dc-3c97-c7cc2c997b56</wsa:MessageID> <wsa:ReplyTo> <wsa:Address>schemas.xmlsoap.org/.../anonymous</wsa:Address> </wsa:ReplyTo> <wsse:Security xmlns:wsse="docs.oasis-open.org/.../oasis-200401-wss-wssecurity-secext-1.0.xsd" env:mustUnderstand="1"> <wsse:UsernameToken> <wsse:Username>PROPER.DOMAIN\PROPER_USER</wsse:Username> <wsse:Password Type="docs.oasis-open.org/.../oasis-200401-wss-username-token-profile-1.0">d1g3stP4ssw0rd==</wsse:Password> <wsse:Nonce>sha1-nonce-here</wsse:Nonce> <wsu:Created xmlns:wsu="docs.oasis-open.org/.../oasis-200401-wss-wssecurity-utility-1.0.xsd">2018-02-07T03:27:31Z</wsu:Created> </wsse:UsernameToken> <wsu:Timestamp xmlns:wsu="docs.oasis-open.org/.../oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsu:Created>2018-02-07T03:27:31Z</wsu:Created> <wsu:Expires>2018-02-07T04:27:31Z</wsu:Expires> </wsu:Timestamp> </wsse:Security> </env:Header> <env:Body> <ns3:GetCustomerList> <ns3:criteria> <ns1:columns xsi:nil="true"/> <ns1:convertToUpperCaseRestriction xsi:nil="true"/> <ns1:restrictions xsi:nil="true"/> <ns2:ClassId xsi:nil="true"/> <ns2:CorporateAccountId xsi:nil="true"/> <ns2:CreatedDate xsi:nil="true"/> <ns2:Id xsi:nil="true"/> <ns2:IsActive xsi:nil="true"/> <ns2:IsOnHold xsi:nil="true"/> <ns2:LastModifiedDate> <ns1:From xsi:nil="true"/> <ns1:GreaterThan>2018-01-01T00:00:00+00:00</ns1:GreaterThan> <ns1:LessThan xsi:nil="true"/> <ns1:To xsi:nil="true"/> </ns2:LastModifiedDate> <ns2:ModifiedDate xsi:nil="true"/> <ns2:Name xsi:nil="true"/> <ns2:PhoneNumber xsi:nil="true"/> <ns2:SalespersonId xsi:nil="true"/> <ns2:State xsi:nil="true"/> </ns3:criteria> <ns3:context xsi:nil="true"/> </ns3:GetCustomerList> </env:Body> </env:Envelope>
*This post is locked for comments