Search code examples
phpsoapwsdl

Soap 1.2 not working with stamps.com


I am feebly trying to implement a stamps.com api interface into my platform. This is my first time using SOAP, I event had to recompile PHP to enable the libraries.

I'm moving along but now I'm having a problem. They support soap 1.1 and soap 1.2 requests, and when I run the following code:

$client = new SOAPClient(
    './SWSIM.wsdl',
    array(
        'trace' => 1
    )
);

I get back a successful response from my request that comes after this.

However if I add the option to use soap 1.2 like this:

$client = new SOAPClient(
    './SWSIM.wsdl',
    array(
        'trace' => 1,
        'soap_version' => SOAP_1_2
    )
);

I get the following error:

There was an exception running the extensions specified in the config file. ---> Value cannot be null. Parameter name: input

This line is not actually throwing the exception. Its the following command that throws it, but removing the soap_version is what "fixes it". I would like to use soap 1.2 so naturally this is bugging me.

FTR The command I'm running is this:

$authData = array(
    "Credentials" => array(
        "IntegrationID" => "MYUID",
        "Username"      => "MYUSERNAME",
        "Password"      => "MYPASSWORD"
    )
);

try { 
    $objectresult = $client->AuthenticateUser($authData);
} catch (Exception $e) { 
    echo "EXCEPTION: " . $e->getMessage();
    print_r($e);
    exit;
} 

The WSDL file can be viewed here: https://swsim.stamps.com/swsim/swsimv22.asmx?wsdl

I have also checked in with their developer support and they said: "The message you are currently receiving is returned from whichever program you are designing your integration with. This has been commonly noted happening within Visual Basic where is creates a wrapper class that needs certain variables for the response. This could be similar to the behavior that you are experiencing. Please verify how your program language consumes a WSDL."

I also noticed that the __soapCall method excepts an "input headers" argument. I'm not entirely sure I should be / can even use that method in my code. I suppose I should just try and play with it.


Solution

  • Check your WSDL file. I was using the wrong one, and it appears you may be as well. Try this one: http://developer.stamps.com/developer/downloads/files/Stamps.com_SWSIM.wsdl

    NOTE: The above is out of date. Contact stamps.com for the current wsdl!