Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serverside example #8

Open
GoogleCodeExporter opened this issue Mar 31, 2015 · 7 comments
Open

serverside example #8

GoogleCodeExporter opened this issue Mar 31, 2015 · 7 comments

Comments

@GoogleCodeExporter
Copy link

There is no example for the serverside code. Something with signing and 
encryption would be nice.

Original issue reported on code.google.com by haavard.pedersen on 13 Aug 2014 at 1:54

@marcusfrenkel
Copy link

It would be great if Rob creates a soap server example compatible to the existing soap-sign-encrypt.php example.

Rob, you are doing a tremendous work. After WSO2 WSF has been abandoned, you are the only hope for a PHP WS-Security lib. Please keep up the good work.

Thanks a million!

@Gijsbos
Copy link

Gijsbos commented Feb 21, 2018

Hi there,

I have been trying to get this working but no luck so far. Could anyone post a simple client/server example that works (on a localhost) where you basically have to add functions and your own certificates?

I created a question on stackoverflow if you are interested to see where I got stuck:
https://stackoverflow.com/questions/48890269/wssesoapserver-not-working-in-php

Many many thanks!

@ZarkoMarkovic
Copy link

ZarkoMarkovic commented Feb 21, 2018

For the client part there is a working example. Some hints for the server part:

  1. Override SoapServer::handle
  2. Use load('php://input') to get the xml request from the client.
  3. Handle decryption and signature with wse-php.
  4. Prepare response using parent method:
ob_start();
   parent::handle($xmlDecryptedRequest);
   $resultPlain = ob_get_contents();
ob_end_clean();	
  1. Encrypt/sign the XML response with wse-php and then return it in this fashion:
header("Content-Length: ".strlen($resultSignedEncrypted) );
echo $resultSignedEncrypted;

@Gijsbos
Copy link

Gijsbos commented Feb 22, 2018

@ZarkoMarkovic Thank you for your tips, but I get the same error over and over again. Function 'EncryptedData' doesn't exist. This implies that I should add operation EncryptedData to my service but is that normal? I can't find any place in the code where this function is called. I added it and the error goes away but adding $server->addFunction("EncryptedData"); doesn't seem right.

I'm sorry, I am rather new to this!

ERROR
Notice: Undefined index: subjectKeyIdentifier in /Applications/MAMP/htdocs/Soap/src/WSSESoap.php on line 347 object(SoapFault)#6 (9) { ["message":protected]=> string(38) "Function 'EncryptedData' doesn't exist" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(41) "/Applications/MAMP/htdocs/soap/client.php" ["line":protected]=> int(74) ["trace":"Exception":private]=> array(1) { [0]=> array(6) { ["file"]=> string(41) "/Applications/MAMP/htdocs/soap/client.php" ["line"]=> int(74) ["function"]=> string(6) "__call" ["class"]=> string(10) "SoapClient" ["type"]=> string(2) "->" ["args"]=> array(2) { [0]=> string(10) "callmethod" [1]=> array(1) { [0]=> int(1) } } } } ["previous":"Exception":private]=> NULL ["faultstring"]=> string(38) "Function 'EncryptedData' doesn't exist" ["faultcode"]=> string(15) "SOAP-ENV:Server" }

@ZarkoMarkovic
Copy link

ZarkoMarkovic commented Feb 22, 2018

Maybe you don't include correctly the XMLSecLibs?

@Gijsbos
Copy link

Gijsbos commented Feb 22, 2018

I checked that but that does not seem to be the issue; would you mind looking at my files?
I run the code in http://localhost/TPS/ on a local MAMP server.

SoapClientServerTest.zip

@ZarkoMarkovic
Copy link

What I can do is share our production files, but over private message due to privacy issues - pls see your linkedin account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants