1
votes

I am using the module strong-soap with Node.js and I am trying to send a request RPC to a web service.

I created a client with options:

var wsdlOptions = {
    attributesKey: '$attributes',
    valueKey: '$value'
};

And I set the parameters as the following:

var args = {
        'para': {
            $attributes: {
                $xsiType: "xsd:string"
            },
            $value: 'a'
        },
        'parb': {
            $attributes: {
                $xsiType: "xsd:string"
            },
            $value: 'b'
        },
        'parc': {
            $attributes: {
                $xsiType: "xsd:string"
            },
            $value: 'c'
        }
    };

However, when I call the method, it produces the xml (envelope):

    <ns1:query xmlns:ns1="http://<host>">
      <para xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="" xsi:type="xsd:string">a</para>
      <parb xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="" xsi:type="xsd:string">b</parb>
      <parc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="" xsi:type="xsd:string">c</parc>
    </ns1:query>

And I get an error message:

The value of the attribute "prefix="xmlns",localpart="xsd",rawname="xmlns:xsd"" is invalid. Prefixed namespace bindings may not be empty.

I did not see any way to set or remove this parameter from the method call. When I set $xsiType inside the parameter, the lib automatically sets an empty xmlns:xsd.

The web service I am interacting with has an old soap implementation and I think this might be the problem. Any suggestions?

1

1 Answers

0
votes

When specifying the value for $xsiType try using the following format:

"{namespace uri}namespace:type"

For example for the xsd namespace you can specify the following:

$xsiType: "{http://www.w3.org/2001/XMLSchema}xsd:string"

The above should yield something along the lines of:

<para xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:type="xsd:string">a</para>