Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifiy XML and replace ns1: by sil: #340

Open
vAugagneur opened this issue Oct 7, 2021 · 2 comments
Open

Modifiy XML and replace ns1: by sil: #340

vAugagneur opened this issue Oct 7, 2021 · 2 comments
Labels

Comments

@vAugagneur
Copy link

Description/Steps to reproduce

var url = "https://www.xxx.fr/xxxxx/sws/sws.asmx?wsdl";
    var args = {
        "SWSLogin": "xxxxx",
        "SWSPassword": "xxxxx",
        "USRLogin": "xxxxx",
        "USRPassword": "xxxxx"
    };
soap.createClient(url, wsdlOptions, function(err, client) {
        var method = client['SWS_SiteLogin'];
        console.log(method);
        method(args, function(err, result, envelope, soapHeader) {
          //response envelope
          console.log('Response Envelope: \n' + envelope);
          //'result' is the response body
          console.log('Result: \n' + JSON.stringify(result));
        });
        console.log(client.lastRequest);
    });

Request

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
  <soap:Header/>
  <soap:Body>
    <ns1:SWS_SiteLogin xmlns:ns1="http://www.silae.fr/">
      <ns1:SWSLogin>xxxxxx</ns1:SWSLogin>
      <ns1:SWSPassword>xxxxxx</ns1:SWSPassword>
      <ns1:USRLogin>xxxxxx</ns1:USRLogin>
      <ns1:USRPassword>xxxxxx</ns1:USRPassword>
    </ns1:SWS_SiteLogin>
  </soap:Body>
</soap:Envelope>

Expected request

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
  <soap:Header/>
  <soap:Body>
    <sil:SWS_SiteLogin>
      <sil:SWSLogin>xxxxxx</sil:SWSLogin>
      <sil:SWSPassword>xxxxxx</sil:SWSPassword>
      <sil:USRLogin>xxxxxx</sil:USRLogin>
      <sil:USRPassword>xxxxxx</sil:USRPassword>
    </sil:SWS_SiteLogin>
  </soap:Body>
</soap:Envelope>

Additional information

can you please help me to find the way to change xml and replace ns1 by sil ?

Best regards

@salmipa
Copy link

salmipa commented Dec 9, 2021

Since nobody has answered anything to you, I will. First of all, your expected request doesn't seem to be valid, since your namespace prefix 'sil' is not declared anywhere. Secondly, if you are dependent on namespace prefixes, you are doomed. Namespace prefixes shouldn't matter. They can be anything, namespace URI is what matters.

@barefooter22
Copy link

Just chiming in because I'm running into the same issue with a vendor that is wanting these prefixes to match. I think from my digging, it looks like the issue could be due to xmlbuilder's lack of support for namespaces. Is it possible that upgrading to xmlbuilder2 could fix this?

https://github.com/oozcitak/xmlbuilder2/blob/master/docs/pages/namespaces.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Icebox
Development

No branches or pull requests

4 participants