I want to access some web service. I use PHP SoapClient like this:
$user_key = "myKey";
$service = new SoapClient('https://myadress.xsd',array(
'trace' => 1,
'exceptions' => true,
"soap_version" => SOAP_1_2
));
$sid = $service->Zaloguj($user_key);`
After that i get Exception "SoapFault: Internal Server Error"
When i call
$service->__getFunctions()
i get list
ZalogujResponse Zaloguj(Zaloguj $parameters)
When i change parameter
"soap_version"=>SOAP_1_1
i get other error:
Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'multipart/related; type="application/xop+xm
i tried many combination like:
$params = new stdClass();
$params->key = $user_key;
$sid = $service->Zaloguj($params);
and i get same error
"SoapFault: Internal Server Error"
Related
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.
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.
I am sending parameters to the login function with the following code, but the result is empty. Where am I making mistakes?
$url = "http://wsdl.lion-playground.com/GambleServerProxy.svc?wsdl";
$client = new SoapClient($url);
$parameters = array("AuthToken"=>"asdsads23123sddds", "Identifier"=>"asdsad22212312", "Password"=>"312312321312321321");
$results = $client->Login("LoginRequest",$parameters);
var_dump($results); // Boş dönüyor ?
Fatal error: Uncaught SoapFault exception: [Client]
SoapClient::SoapClient(): 'location' and 'uri' options are required in
nonWSDL mode in /home/mornetajans/public_html/demo2/test.php:9
i have problem with using soapclient in php. I have this code
$url = 'https://example.com?wsdl';
$soap = new SoapClient($url, array('trace' => true));
print_r($soap->__getFunctions());
$requestHeader = array(..);
$requestObject = array(..);
$request = array(
"Header" => $requestHeader,
"RequestObject" => $requestObject,
);
$createResponse = $soap->ServiceList(array('Request' => $request));
Which returns this error
Uncaught SoapFault exception: [HTTP] HTTP to HTTPS communication - Please reconfigure Your client to use HTTPS secured communication on port 443
Calling __getFuncitons is ok, it prints aviable functions, but when i call some of that functions, i get that error. I was searching for some tutorial or advice, but unsuccessfully. Do you have any advice for me ?
I am trying to call siebel wsdl,
$wsdl = '/home/netvibes/mysw/public/r2/img/isusertrusted.wsdl';
$client = new SoapClient($wsdl, array(
"trace"=>1,
"exceptions"=>0));
$auth = array(
'UsernameToken' => 'EXTAPP',
'PasswordText' => 'EXTAPP'
);
$header = new SoapHeader('NAMESPACE', 'Auth', $auth, false);
$client->__setSoapHeaders($header);
$result = $client->__call('Execute_Service', array('appthai123zz#zzhotmail.swk') );
I dont know what i am doing wrong, but when i do this i get,
Error Code: 10944642 Error Message: Error: Inbound SOAP Message - Session Token is missing
May be something is wrong with the header. can someone please help?
This error is typical when you send a message that is missing the session token tag. This token is sent back by Siebel after the initial login, which prevents having to log in for each message - reducing the authentication overhead.
I am trying to get the status of issues from Mantis. Having search through other posts here, people indicate that the web service on their site should be working. However I get the error when attempting this. Openssl, SOAP, curl, etc... are all enabled in my PHP (5.4.26).
Sample code: (External Mantis works)
<?php
$SoapWSDLAddress = 'http://www.mantisbt.org/demo/api/soap/mantisconnect.php?wsdl';
$Client = new SoapClient($SoapWSDLAddress, array('trace' => true, 'encoding' => 'UTF-8', 'soap_version' =>SOAP_1_2));
...
?>
Internal Site, which has MantisConnect installed that gets Exception.
<?php
$SoapWSDLAddress = 'http://192.168.0.1/mantis/api/soap/mantisconnect.php?wsdl';
$Client = new SoapClient($SoapWSDLAddress, array('trace' => true, 'encoding' => 'UTF-8', 'soap_version' =>SOAP_1_2));
...
?>
I get an exception on the SoapClient call:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from ' http://192.168.0.1/mantis/api/soap/mantisconnect.php?wsdl' : failed to load external entity "http://192.168.0.1/mantis/api/soap/mantisconnect.php?wsdl"
Going to the web address in my browser does show me the output for Mantis connect.
Original code posting had a space before the http:// which caused the problem. Changing the code to remove the space fixed the error.
$SoapWSDLAddress = 'http://www.mantisbt.org/demo/api/soap/mantisconnect.php?wsdl';
$Client = new SoapClient($SoapWSDLAddress, array('trace' => true, 'encoding' => 'UTF-8', 'soap_version' =>SOAP_1_2));
...