I need to setup a php soapserver that only accepts traffic from a specific (validated) certificate. I've searched everywhere, but have not found a way to do that.
I currently use
$server = new SoapServer($this->wsdl);
It would be amazing if something like this would work:
$server = new SoapServer($this->wsdl, array('local_cert' => $this->cert_file, 'passphrase' => $this->passphrase));
Any help is greatly appreciated.
Related
I have written web service in PHP. It has been working fine for couple of weeks. Today I had to change my SOAP client to be in non WSDL form, after making the following change, I am getting this annoying error:
Procedure 'FUNCTIONNAME' not present
My code:
//$client = new SoapClient("STWebServiceWSDL.wsdl", array('trace' => 1));
//This is working, but why, non wsdl below not working
$client = new SoapClient(null, array('location' => "https://mysite.com/STserver.php",
'uri' => "https://mysite.com/STserver.php",
'trace'=>1));
Please help, I could not find any solution on the Net for the whole day.
My SOAP server is like this:
$server = new SoapServer("STWebServiceWSDL.wsdl");
I am trying to connect to a WSDL that uses WS-Security Certificate Signing over HTTPS.
Only the outgoing messages are signed and it uses Binary Security Token (could not find this specific option in WSO2 but so I am unsure I am using the correct option in the code below).
I have looked at the code in the Samples of the WSO2 WSF/PHP and have joined together the WDSL client example and the Signing example.
Code:
$my_cert = ws_get_cert_from_file("./keys/cert.pem");
$my_key = ws_get_key_from_file("./keys/key.pem");
$sec_array = array("sign"=>TRUE,
"algorithmSuite" => "Basic256Rsa15",
"securityTokenReference" => "EmbeddedToken"); //Is this correct for Binary Security Token?
$policy = new WSPolicy(array("security"=>$sec_array));
$sec_token = new WSSecurityToken(array("privateKey" => $my_key,
"certificate" => $my_cert));
$client = new WSClient(array("wsdl"=>"https://.../Informationservice.WSDL",
"useWSA" => TRUE,
"policy" => $policy,
"securityToken" => $sec_token));
$proxy = $client->getProxy();
$return_val = $proxy->StreetTypes();
Any help would be much appreciated as I haven't been able to find an examples of connecting to a service like this online anywhere. Most services seem to sign with Username and Password rather than Certificates and when looking for WSDL and Certificate Signing I don't find anything at all.
You need to specify the CACert option for https to work with "to" endpoint set to the https endpoint. Also use the non wsdl mode as there are some known issues with wsdl mode.
I have seen little to know instruction on using php to develop a client website to make remote calls to JiRA.
Currently I'm trying to make a soap client using JSP/Java to connect to a local jira instance. I would like to create and search issues that is all. We are currently having some problems using Maven2 and getting all the files we need from the repository since we are behind a major firewall(yes I've used the proxy).
I have a lot of experience with PHP and would like to know if using the PHP soapclient calls can get the job done.
http://php.net/manual/en/soapclient.soapclient.php
Yes it can be done, using SOAP or XML-RPC.
Using the APIs is pretty much straight forward - have a look at the API documentation to find the right functions for you. your code should look something like :
<?
$soapClient = new SoapClient("https://your.jira/rpc/soap/jirasoapservice-v2?wsdl");
$token = $soapClient->login('user', 'password');
...
... # get/create/modify issues
...
?>
Example of adding a new comment:
$issueKey = "key-123";
$myComment = "your comment";
$soapClient = new SoapClient("https://your.jira/rpc/soap/jirasoapservice-v2?wsdl");
$token = $soapClient->login('user', 'password');
$soapClient->addComment($token, $issueKey, array('body' => $myComment));
Example of creating an issue:
$issue = array(
'type'=>'1',
'project'=>'TEST',
'description'=>'my description',
'summary'=>'my summary',
'priority'=>'1',
'assignee'=>'user',
'reporter'=>'user',
);
$soapClient = new SoapClient("https://your.jira/rpc/soap/jirasoapservice-v2?wsdl");
$token = $soapClient->login('user', 'password');
$soapClient->createIssue($token, $issue);
Note that you need to install php-soap in linux (or it's equivalent in windows) to be able to use the SOAP library.
I'm trying to use an external webservice but I get the error Parsing Schema: can't import schema from webservice_url. The service uses HTTP Basic authentication and is using SSL. I can login via a web browser and see the xml it produces but I can't change what is generated since it is not my code generating the xml. I have the following code.
$config = array('login' => $user_id, 'password' => $password);
$client = new SoapClient($url, $config);
Well after researching and reading a bunch of articles online it seems like this is a limitation of php-soap and some suggestions point at using curl to accomplish. I actually decided to avoid PHP entirely since I just learned Ruby and have been going away from PHP. I accomplished my above task by using the Savon gem which has some pretty good documentation on the authentication and setting the cookie. It works great using this gem.
I found this on the SoapClient manual page's comment section:
<?php
$login = 'someone';
$password = 'secret';
$client = new SoapClient(
'https://' . urlencode($login) . ':' . urlencode($password) . '#www.server.com/path/to/wsdl',
array(
'login' => $login,
'password' => $password
)
);
?>
Seems like the basic authentication is for the endpoint invocation, not the WSDL retrieval.
I am using the following code to read attendance data from a biometric device:
<?php
$options = array(
'location' => 'http://192.168.1.178/iWsService',
'uri' => 'http://www.zksoftware/Service/message/'
);
$client = new SoapClient(null, $options);
$soapRequest = "<GetAttLog><ArgComKey xsi:type=\"xsd:integer\">0</ArgComKey><Arg><PIN xsi:type=\"xsd:integer\">All</PIN></Arg></GetAttLog>";
$response = $client->__doRequest($soapRequest, 'http://192.168.1.178/iWsService', '', '1.1');
echo '<pre>', var_dump(htmlspecialchars($response, ENT_QUOTES)), '</pre>';
?>
This just works fine. But since we do not have the documentation/manual/API Reference for this particular device (and nowhere available), I have no clue on what other functions are available in this machine.
Is there any luck finding out what other SOAP parameters this device could accept?
Your help would be really valuable at this moment. Thank you!
At last I found the SOAP SDK Manual of zksoftware.
Since I was searching for the manual for almost a year, I am uploading it to my server for the benefit of future users:
http://www.myfurni.com/downloads/zksoftware_SOAPSDKManual.pdf
Edit:
The above link doesn't work anymore. Here is the new one:
https://drive.google.com/file/d/0ByvozREXZpckcHlHYnZoOTMtWjg/view?usp=sharing
I don't think it is possible. WSDL is the source of information about functions and arguments. No WSDL - no function list.
Try this It uses the UDP protocol to communicate to the Attendance Machine.