Jump to content

SOAP Error: The SOAP action specified on the message, '', does not match the


keyboardcowboy

Recommended Posts

Hey fellas!

 

i've tried everything! I'm using this WSDL : http://test.psdataservices.com/PSShipCarrierAPI/PSShipCarrier.svc?WSDL and am simply just trying to authenticate. I keep getting this error:

 

The SOAP action specified on the message, '', does not match the HTTP SOAP Action, 'http://tempuri.org/IPSShipCarrier/Authenticate'

 

Here is my code:

$options = array(
        "soap_version" => SOAP_1_2,
        "trace"=>1,
        'UserName'=>'blahremoved',
        'Password'=>'blahremoved',
        'AuthToken'=>'blahremoved',
        'SOAPAction'=>'http://tempuri.org/IPSShipCarrier/Authenticate',
        'Action'=>'http://tempuri.org/IPSShipCarrier/Authenticate',
        'uri'=>'http://tempuri.org/IPSShipCarrier/Authenticate',
        'exceptions'=>true );

    $client = new SoapClient( "http://test.psdataservices.com/PSShipCarrierAPI/PSShipCarrier.svc?WSDL", $options );

    $auth = array(
        'UserName'=>'blahremoved',
        'Password'=>'blahremoved',
        'AuthToken'=>'blahremoved',
        'SOAPAction'=>'http://tempuri.org/IPSShipCarrier/Authenticate',
        'Action'=>"Authenticate"
    );
    $header = new SoapHeader('http://tempuri.org/IPSShipCarrier/Authenticate','Authenticate',$auth,false);

    $client->__setSoapHeaders($header);

    $params = new StdClass;
    $params->Action = "http://tempuri.org/IPSShipCarrier/Authenticate";
    $params->SOAPAction = "http://tempuri.org/IPSShipCarrier/Authenticate";
    $params->UserName = "blahremoved";
    $params->Password = "blahremoved";
    $params->AuthToken = "blahremoved";
$client->Authenticate($params);

 

Thanks in advance!  Much appreciated.

That looks like a bit of a mess.  You've provided the action and other variables in 3 different places.

 

The first step for soap debugging is to start out by seeing what the soap library is really sending.  For that you can use these:

 

http://www.php.net/manual/en/soapclient.getlastrequest.php

http://www.php.net/manual/en/soapclient.getlastrequestheaders.php

 

Also you can remove your authentication info from $options, SoapClient is not interested in them.  The soap client options are listed here:

 

http://www.php.net/manual/en/soapclient.soapclient.php

 

These should either be in the headers or passed to the client in $params, depending on what is expected.  Even then you can have other problems if the server is not written to expect php's soap library as a client.. and that's where you need to see the actual message to debug it.

Thanks for your response.  I passed them 3 times just to make sure ... It doesn't mess the response up by doing so.  Wanted to make sure I had all my bases covered.  I just need to know how to pass that action variable to the http ... Thoughts ?

If that's a microsoft soap server I would be looking at the MSDN soap documentation.  AFAIK their soap servers expect the action in the headers.  Which you appear to be doing.. maybe try SoapAction instead of SOAPAction?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.