doedje / jquery.soap

This script uses $.ajax to send a SOAP:Envelope. It can take XML DOM, XML string or JSON as input and the response can be returned as either XML DOM, XML string or JSON too.
352 stars 147 forks source link

NULL parameters not handled correctly #24

Closed samuelcampos closed 11 years ago

samuelcampos commented 11 years ago

When we try to send NULL parameters trough a SOAP request it fails.

The error shown in FireBug is the following:

TypeError: params is null
if(params.constructor.toString().indexOf("Array") != -1) {// type is array

This page shows how to handle NULL parameters: http://technet.microsoft.com/en-us/library/ms190796%28v=sql.105%29.aspx

doedje commented 11 years ago

could you pass me your $.soap call? When I do:

$.soap({ 
  params: null,  
  ...
});

I don't get any errors

samuelcampos commented 11 years ago

For example, give the following call:

$.soap({
            method: 'getMessages',
            SOAPAction: this.namespaceURL + '/getMessages',
            params: {
                language: null,
                codes: "code1:code2"
            },
            success: function(soapResponse) {
...
            }
        });

When a parameter is NULL, the parameter should be translated to something like:

<language nil="true" />  

But I get the error mentioned above.

doedje commented 11 years ago

Ah, now I understand. I will look into it...

samuelcampos commented 11 years ago

Thank you. I am keep testing it but I think it works just fine now :)

doedje commented 11 years ago

cool! you're welcome!