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 ?
Related
I have some problem with consuming web service wsdl php client.
I need to read all information from the service but he return this java.lang.NullPointerException but if I limit at 100 its works. I don't know where is the problem.
This my code
ini_set("soap.wsdl_cache_enabled", "0");
$client = new soapclient("http://localhost:8080/ProjectServices/services/Services?wsdl");
$param = array(__function__ => array('requete' => $sql,'limit' => $limit,'offset' => $Ndeb));
$response = $client->__soapCall("listproduit", $param);
var_dump($response);
I am trying to call a HTTPS ASMX service from my PHP blog
Here is my code
$param1="Web Submission";
$param2="Lead";
$param3="flase";
$param0=$comment_content;
if (!empty($comment_content)){
$client = new SoapClient("https://devop.setars.com/webservice/sellblog.asmx?wsdl");
$params->Notes=$param0;
$params->Type=$param1;
$params->PURPOSE=$param2;
$params->IsMail=$param3;
$result=$client->AddActivity($params);
}
When I tested this locally with HTTP it is working fine, but when hosting with HTTPS, it doesn't appear to be making the call correctly.
$param1="Web Submission";
$param2="Lead";
$param3="flase";
$param0=$comment_content;
if (!empty($param0)){
$client = new SoapClient("http://localhost:52078/WebService/SellBlog.asmx?wsdl");
$params->Notes=$param0;
$params->Type=$param1;
$params->PURPOSE=$param2;
$params->IsMail=$param3;
$result=$client->AddActivity($params);
}
I tried with this also but no solution
$soap_options = array(
'trace' => 1,
'exceptions' => 1 ,
);
$wsdl = "https://dev234.sentsis.com/webservice/sellblog.asmx?WSDL";
$param1="Web Submission";
$param2="Lead";
$param3="flase";
$param0=$comment_content;
if (!empty($comment_content)){
$client = new SoapClient( $wsdl, $soap_options);
$params->Notes=$param0;
$params->Type=$param1;
$params->PURPOSE=$param2;
$params->IsMail=$param3;
$result=$client->AddActivity($params)->AddActivityResult;
}
Is there any difference between making a service call from PHP to a HTTP service compared to a HTTPS one?
If you want to connect to a server that only supports SSLv2/3 and/or TLS 1.0 (no TLS 2 or 3), tell the SOAP client if you get a connection error by setting the appropriate stream context, example:
<?php
$opts = array(
'ssl' => array('ciphers'=>'RC4-SHA')
);
$client = new SoapClient(
'https://example.com/?wsdl',
array ( "encoding"=>"ISO-8859-1",
'stream_context' => stream_context_create($opts)
// your options
);
?>
You might need to disable the SOAP caching of WSDLs in order for the SOAP client to use the new context.
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"
There is a wcf server and I am trying to connect it and send requests.
The code is :
$url = "http://serverip:8080/example.svc?wsdl";
$params = array(
'Username' => 'username',
'Password' => 'password'
);
$client = new SoapClient($url);
var_dump($client->__getTypes()); //it works
$result = $client->Login($params); //gives error
But everytime I am getting internal server error. I spend 5 days and searhed all the web and tried all different methods but I am always getting internal server error. Error is below :
protected 'message' => string 'The server was unable to process ...
private 'string' (Exception) => string '' (length=0) ...
If I use SOAP UI I can send and get data or if I call "$client->__getTypes()" from php server, I get types. But if I call implemented functions with PHP it doesn't work. Are there anyone to help me?
Thanks a lot,
Perhaps you should pass the parameters as object as in the following example
try {
$client = new SoapClient('http://serverip:8080/example.svc?wsdl');
$params = new stdClass();
$params->Username = 'Username';
$params->Password = 'Password';
$client->Login($params);
} catch (SoapFault $e) {
// error handling
}
I'm having some problems connecting to MS web service hosted at appharbor.com
Here's the php code:
ini_set('soap.wsdl_cache_enabled',0);
ini_set('soap.wsdl_cache_ttl',0);
$options = array(
'soap_version'=>SOAP_1_2,
'exceptions'=>true,
'trace'=>1,
'cache_wsdl'=>WSDL_CACHE_NONE
);
try {
$client = new SoapClient("http://ppjparsanje.apphb.com/Prazniki.asmx?wsdl", $options);
print_r($client->__call("get_praznike", array("json")));
print_r($client->get_praznike("json"));
print_r($client->__soapCall("get_praznike", array("json"), array('soapaction' => 'http://ppjparsanje.apphb.com/get_praznike')));
} catch(Excteption $e) {
echo $e->getMessage()."<br />";
}
The error is:
Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host
Which is strange because service seems to work fine. I have also tried to add port 14275, but no luck. Any suggestions?
Thanks in advance!
you have made a mistake the soap has version 1 na your are passing 1.2 in options then how will it connect
$soapClient = new SoapClient('http://ppjparsanje.apphb.com/Prazniki.asmx?wsdl', array('cache_wsdl' => WSDL_CACHE_NONE) );
print_r($soapClient);
i get output:- hence due to bad code you are getting error
SoapClient Object ( [_soap_version] => 1 [sdl] => Resource id #3 )
well here i have acceses uk mail api
take a look at how i have called a method its bit diffrent
but u will get an idea
php soap client for uk mail webservice api?