Webservice method getting null parameters

Bogdan9119Bogdan9119 Member Posts: 14
When I call my webmethod from browser it runs okay and gives results, but when called from NAV 2017 all passed arguments are null. This is the xml http request I generate from NAV:
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<BarcodePrintZpl>
<user>testuser</user>
<variablesString>testvars</variablesString>
<filepath>testfile</filepath>
<printerName>testprinter</printerName>
</BarcodePrintZpl>
</soap:Body>
</soap:Envelope>

And that's the request in browser, which works:
<?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>
    <BarcodePrintZpl xmlns="http://tempuri.org/">
      <user>string</user>
      <variablesString>string</variablesString>
      <filepath>string</filepath>
      <printerName>string</printerName>
    </BarcodePrintZpl>
  </soap:Body>
</soap:Envelope>

I think it could be related to namespaces of child elements inside BarcodePrintZpl . If I set the namespace for BarcodePrintZpl then all child nodes get some default empty namespace. When I try to remove the default namespace with removeAttribute('xmlns') it's still there. Can you help me?

Answers

  • krikikriki Member, Moderator Posts: 9,115
    [Topic moved from 'NAV/Navision Classic Client' forum to 'NAV Three Tier' forum]

    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • zaidtariqzaidtariq Member Posts: 52
    edited 2017-09-28
    Try by including the encoding scheme too in your XML request.
    Best Regards:
    Zaid Tariq
    Dynamics NAV/365 BC Developer at Dynamics 360

    please like / agree / verify my answer, if was helpful.
  • vaprogvaprog Member Posts: 1,144
    A namespace is not just an attribute. I don't quite get what you do and where you do it when you say "I try to remove the default namespace with removeAttribute('xmlns')"

    Anyway, stick to the schema given by the WSDL document, including namespaces, and use the proper methods, parameters or properties for namespaces. Don't define them as attributes, unless you create the whole request as text.
Sign In or Register to comment.