4
votes

I am trying to connect my script to the SOAP client. But when I try to do it throws the mentioned error. When I tried to get the function with $client->__getFunctions(). It shows all the function. when I try to call them it ends in fatal error.

$client = new SoapClient("http://bsestarmfdemo.bseindia.com/MFOrderEntry/MFOrder.svc?singleWsdl",array(
    'soap_version' => SOAP_1_2, // !!!!!!!
));
var_dump($client->__getFunctions()); 
//var_dump($client->__getTypes());

$login_params = array(
    'UserId' => 123456,
    'Password' => 123456,
    'PassKey' => 1234569870,

  );

//$response = $client->getPassword($login_params);
$response = $client->__soapCall('getPassword', array($login_params));
dd($response);

if i change the SOAP version to 1.1 i get another error Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'. Would be great if i come to know what i am missing here.

1
Did you ever find the solution? We're running into the same problem.ReSpawN
yes i did find a work around. The issue in my case was it expects ws-addressing which is not sent in my case. Have a look at it. @ReSpawN. There can be also mismatch in soap version.Naveen Kumar
@NaveenKumar can you please post the solution. we are actually facing the same issue.Wocugon
@NaveenKumar can u please post the solution , actually i m also facing same issue. and i too want data from bsestarshashikant kuswaha
@Wocugon can you also post , if you have found the solution because i need it urgently. please help me out guys.shashikant kuswaha

1 Answers

1
votes

To address the reply made by @Naveen Kumar: this was my solution.

// Apply WSA headers
$action = new \SoapHeader('http://www.w3.org/2005/08/addressing', 'Action', self::ACTION_PREFIX.$this->action);
$to = new \SoapHeader('http://www.w3.org/2005/08/addressing', 'To', $this->endpoint);
$this->client()->__setSoapHeaders([$action, $to]);

In the end, $this->client simply returns an instance of \SoapClient and the action contains the full URL to the method. Naturally, the To portion is optional, but in my case it obviously points towards the endpoint specified in the .wsdl file.