Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rumm.an's avatar
Level 17

Need Help in consuming a SOAP webservice

Here's What I am trying (In a test):

$options = [
    'soap_version'=> SOAP_1_2,
    'exceptions'=> true,
    'trace'=> 1,
    'cache_wsdl'=>WSDL_CACHE_NONE,
];

$url = "http://bsestarmfdemo.bseindia.com/MFOrderEntry/MFOrder.svc?singleWsdl";
$client = new \SoapClient($url, $options);

$params= [....];
$response = $client->__soapCall( 'getPassword', compact('params'));

dd($response);

#Error (when running test):

SoapFault: The SOAP action specified on the message, '', does not match the HTTP SOAP Action, 'http://bsestarmf.in/MFOrderEntry/getPassword'

In SoapUI client this API returns the same error. But in the SoapUI, if I check Add default wsa:To option under WS-A tab, it works perfectly and returns correct response

0 likes
3 replies
rumm.an's avatar
rumm.an
OP
Best Answer
Level 17

Fixed it myself!

$headers = [
    new \SoapHeader(
        'http://www.w3.org/2005/08/addressing', 
        'Action', 
        'http://bsestarmf.in/MFOrderEntry/getPassword',
        $mustUnderstand = true
    ),
    new \SoapHeader(
        'http://www.w3.org/2005/08/addressing', 
        'To', 
        'http://bsestarmfdemo.bseindia.com/MFOrderEntry/MFOrder.svc',
        $mustUnderstand
    ),
];
$client->__setSoapHeaders($header);
//now call the method
$client->$response = $client->__soapCall('getPassword', compact('params'));
ashiqdey's avatar

define('LIVE', 0); $MEMBERID = ['38381','']; $USERID = ['3838102','']; $PASSWORD = ['@12345',''];

$options = [ 'soap_version'=> SOAP_1_2, 'exceptions'=> true, 'trace'=> 1, 'cache_wsdl'=>WSDL_CACHE_NONE, ];

$url = "http://bsestarmfdemo.bseindia.com/MFOrderEntry/MFOrder.svc?singleWsdl"; $client = new \SoapClient($url, $options);

$headers = [ new \SoapHeader( 'http://www.w3.org/2005/08/addressing', 'Action', 'http://bsestarmf.in/MFOrderEntry/getPassword', $mustUnderstand = true ), new \SoapHeader( 'http://www.w3.org/2005/08/addressing', 'To', 'http://bsestarmfdemo.bseindia.com/MFOrderEntry/MFOrder.svc', $mustUnderstand ), ]; $client->__setSoapHeaders($header);

$params = array( 'MemberId' => $MemberId[$LIVE], 'UserId' => $UserId[$LIVE], 'Password' => $password[$LIVE], 'PassKey' => $passkey[$LIVE] );

try{ $client->$response = $client->__soapCall('getPassword', compact('params')); }catch(Exception $e) { echo 'Message: '.$e->getMessage(); }

Whats wrong with my code? M still getting the error: Message: The SOAP action specified on the message, '', does not match the HTTP SOAP Action, 'http://bsestarmf.in/MFOrderEntry/getPassword'.

Please or to participate in this conversation.