GP 2015 Web Service SOAP Request Question

  • GP 2015 Web Service SOAP Request Question

    Posted by DSC Communities on April 15, 2020 at 4:37 pm
    • Angela Morehouse

      Member

      April 15, 2020 at 4:37 PM

      I am able to get GP Web Services working in my .NET code, but am having an issue when trying to call a service with a SOAP request. For an example, I’m trying to use the “GetVendorByKey” endpoint. In my .NET code, all I did was set the CompanyKey, VendorKey and OrganizationKey, so that’s all I attempted to set in the SOAP request as well. The following was my request.

      Ā 

      <SOAP:Envelope xmlns:SOAP=”http://schemas.xmlsoap.org/soap/envelope/“>

      Ā  <SOAP:Body>

      Ā Ā Ā  <GetVendorByKey xmlns=”http://schemas.microsoft.com/dynamics/gp/2006/01“>

      Ā Ā Ā Ā Ā  <key>

      Ā Ā Ā Ā Ā Ā Ā  <CompanyKey>

      Ā Ā Ā Ā Ā Ā Ā Ā Ā <ns0:Id xmlns:ns0=”http://schemas.microsoft.com/dynamics/2006/01“>1</ns0:Id>

      Ā Ā Ā Ā Ā Ā Ā  </CompanyKey>

      Ā Ā Ā Ā Ā Ā Ā  <Id>102</Id>

      Ā Ā Ā Ā Ā  </key>

      Ā Ā Ā Ā Ā  <context>

      Ā Ā Ā Ā Ā Ā Ā  <ns0:OrganizationKey xmlns:ns0=”http://schemas.microsoft.com/dynamics/2006/01” />

      Ā Ā Ā Ā Ā  </context>

      Ā Ā Ā  </GetVendorByKey>

      Ā  </SOAP:Body>

      </SOAP:Envelope>

      Ā 

      However, I receive no data back from the SOAP response when doing this. A similar request through my .NET code like the following worked just fine:

      Ā 

      Ā Ā Ā Ā Ā Ā Ā  Dim companyKey As CompanyKey = New CompanyKey()

      Ā Ā Ā Ā Ā Ā Ā  Dim context As Context = New Context()

      Ā Ā Ā Ā Ā Ā Ā  Dim vendorKey As VendorKey = New VendorKey()

      Ā Ā Ā Ā Ā Ā Ā  Dim vendor As Vendor

      Ā 

      Ā Ā Ā Ā Ā Ā Ā  companyKey.Id = 1

      Ā Ā Ā Ā Ā Ā Ā  context.OrganizationKey = companyKey

      Ā Ā Ā Ā Ā Ā Ā  vendorKey.Id = “102”

      Ā 

      Ā Ā Ā Ā Ā Ā Ā  vendor = wsDynamicsGp.GetVendorByKey(vendorKey, context)

      Ā 

      Any thoughts on what I might be doing wrong with the SOAP request? I’ve tried both leaving the Orgainzation Key parameter like the default above…and also actually filling it in with the same value as the company ID like I did in my .NET code. Neither worked.

      Ā 

      ——————————
      Angela Morehouse
      CC Industries
      Chicago IL
      ——————————

    • Thomas Garcia

      Member

      April 16, 2020 at 4:24 PM

      Hi .

      The first thing I see here is the way you are passing the CompanyKey for example. It should be like this:

      <OrganizationKey xsi:type=”CompanyKey”><Id>-1</Id></OrganizationKey>?

      It would help if you post the exception recorded by WebServices.

      Hope it helps!

      ——————————
      Thomas Garcia
      ICON Business Consulting, LLC | Miami FL
      ICON, SRL | Santiago, Dominican Republic
      954-804-2140
      ——————————
      ——————————————-

    DSC Communities replied 5 years, 6 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘GP 2015 Web Service SOAP Request Question’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!