Hi, You are getting this NPE because you have not added the RampartConfig assertion in the policy of services.xml
Please see here for a sample : https://svn.apache.org/repos/asf/webservices/rampart/trunk/java/modules/rampart-samples/policy/sample03/services.xml Please add the configured "RampartConfig" assertion and then try again. We rested php-java interop with a WSO2 WSAS instance (which uses Axis2 and Rampart), if you are interested I can host that WSAS instance for you to download. Thanks, Ruchith shams jawaid wrote: > Hi kaushalye, > > sorry about that!! ill stick to this wsf/rampart/java service problem > first and provide details :). its good to hear the interoperablity > worked fine with a php client and java web service! is it possible that > i can see your interop example including the java service, and the > service configuration you used? because i checked my client against > yours and used your policy.xml file, but i got a : > nullpointer error in tcp mon and something about x509 in the tomcat > output, i attached those errors(tcpmon output, and a tomcat window > output - ) and my services.xml file. Can you see any differences.. > > >> Date: Fri, 21 Sep 2007 11:40:15 +0530 >> From: [EMAIL PROTECTED] >> To: [EMAIL PROTECTED]; [email protected] >> Subject: Re:RE: [wsf-php-user] signature and encryption >> >> Hi Shams, >> We did an interop between a PHP client and a Java service. It all worked >> fine.:) >> And we used the certificate/key pairs available in the PHP. Herewith >> I'll attach my sample code and the policy. >> So again that Exception can be caused by a misconfiguration in the Java >> service. You may try the latest version available here[1] as nightly >> builds. >> Also I'd like to pay your attention on this. When you troubleshoot, >> please try to use the elimination criteria, where you identify possible >> reasons for the problem and eliminate one by one. If you try to jump to >> another case in the middle of the process you will probably miss the >> chance of isolating the exact reason. Since there are many people >> willing to help you. It's much easier for us if you can stick to a >> certain problem and resolve it first. As in Manjula's reply you might >> get a correct answer but for another issue, which makes it's invalid and >> probably misguide you wasting your time. :) >> You are most welcome to post your problems and we are happy to help you >> to overcome those. But you have to include information. For example >> logs, client code, policy files and message traces. Just saying that I >> get more errors doesn't make any sense. >> Cheers, >> Kaushalye >> [1] http://dist.wso2.org/products/wsf/php/nightly-build/ >> >> >> shams jawaid wrote: >> > >> > Hi kaushalye, >> > thats cool! i am doing my final year project with him at city >> > university! :D i havent tried it with a php service, but when i try to >> > use differnt services.xml files or policy.xml files, the badencoding >> > error goes away, but i get more errors..i keep thinking i have an >> > error there, did my java keystore verify this time :S i havent tried >> > using a php service yet.. >> > > Date: Thu, 20 Sep 2007 22:24:02 +0530 >> > > From: [EMAIL PROTECTED] >> > > To: [EMAIL PROTECTED] >> > > Subject: Re: [wsf-php-user] signature and encryption >> > > CC: [email protected] >> > > >> > > Hi, >> > > Your client seems perfect to me. So as the generated message. Though >> > > I'm not an expert understanding the Java exception, I feel like >> > there is >> > > a configuration error in the service end. It says badEncoding resource >> > > property. May be java guys have a better answer(this will be posted in >> > > rampart-dev as well). I need sometime to look into this issue. > Have you >> > > tried PHP client with a PHP service? You may use the sample code I've >> > > sent in my previous reply. >> > > Cheers, >> > > Kaushalye >> > > PS: Indeed I know Dasun. He is a good friend of mine. :) >> > > >> > > shams jawaid wrote: >> > > > Hi kaushalye, >> > > > >> > > > my java web service works alright and it shows up on axis2, and > i can >> > > > see the wsse security headers as well. i also converted the sample >> > > > keys you get with the wsf samples into a keystore so that they > can be >> > > > used in rampart. i only get the message signed and encrypted, but at >> > > > the recieving end i get : >> > > > >> > > > HTTP/1.1 500 Internal Server Error >> > > > Server: Apache-Coyote/1.1 >> > > > Content-Type: application/soap+xml; >> > > > >> > action='http://www.w3.org/2005/08/addressing/soap/fault';charset=UTF-8 >> > > > <http://www.w3.org/2005/08/addressing/soap/fault> >> > > > Transfer-Encoding: chunked >> > > > Date: Thu, 20 Sep 2007 17:01:36 GMT >> > > > Connection: close >> > > > 28E >> > > > <?xml version='1.0' encoding='UTF-8'?> >> > > > <soapenv:Envelope >> > > > xmlns:soapenv='http://www.w3.org/2003/05/soap-envelope' >> > > > xmlns:wsa='http://www.w3.org/2005/08/addressing'> >> > > > <soapenv:Header> >> > > > >> > > > >> > <wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</wsa:Action> >> > > > >> > > > <wsa:RelatesTo>9a11d849-d295-42c1-ae0b-0697b8280fc8</wsa:RelatesTo> >> > > > </soapenv:Header> >> > > > <soapenv:Body> >> > > > <soapenv:Fault> >> > > > <soapenv:Code> >> > > > <soapenv:Value>soapenv:Receiver</soapenv:Value> >> > > > </soapenv:Code> >> > > > <soapenv:Reason> >> > > > <soapenv:Text >> > > > xml:lang='en-US'>java.lang.RuntimeException: Undefined 'badEncoding' >> > > > resource property</soapenv:Text> >> > > > </soapenv:Reason> >> > > > <soapenv:Detail /> >> > > > </soapenv:Fault> >> > > > </soapenv:Body> >> > > > </soapenv:Envelope> >> > > > 0 >> > > > >> > > > ill attach the files here, and if you can, please have a look, i > dont >> > > > know what else to do really :S >> > > > thanks for your help! and by the way, do you know dasun weerasinghe? >> > > > my project supervisor says he knows you! >> > > > >> > > > >> > > > > Date: Thu, 20 Sep 2007 20:50:40 +0530 >> > > > > From: [EMAIL PROTECTED] >> > > > > To: [EMAIL PROTECTED] >> > > > > CC: [email protected] >> > > > > Subject: Re: [wsf-php-user] signature and encryption >> > > > > >> > > > > Hi Shams, >> > > > > Have you resolved the issue setting up your Java service? > Otherwise >> > > > > there is no point of trying sending client requests. >> > > > > Can you see the <wsse:Security> header is in the request? Please >> > attach >> > > > > log and trace of SOAP messages when you post a problem (as there >> > is no >> > > > > other way we can find the reason). :) >> > > > > Please find a complete PHP sample here[1]. >> > > > > Cheers, >> > > > > Kaushalye >> > > > > >> > [1]http://wso2.org/repos/wso2/trunk/wsf/php/samples/security/complete/ >> > > > > >> > > > > >> > > > > shams jawaid wrote: >> > > > > > Hi, i am trying to implement sample 03 of rampart 1.3 policy >> > samples >> > > > > > using wsf php extension and axis2/java 1.3 + rampart 1.3, >> > however i >> > > > > > get the error: >> > > > > > >> > > > > > policy creation failedSoap Fault: Missing wsse:Security > header in >> > > > request >> > > > > > >> > > > > > i have just referenced the sample policy file from my php >> > client, and >> > > > > > used the sample services.xml file as well, and i havent changed >> > > > > > anything apart from the reference to the PWCBHanlder class. >> > > > > > >> > > > > > here is my php client : >> > > > > > >> > > > > > <?php >> > > > > > $reqPayloadString = <<<XML >> > > > > > <ns1:add >> > > > > > >> > > > >> > > xmlns:ns1='http://math'><ns1:Param0>1</ns1:Param0><ns1:Param1>1</ns1:Param1> >> > > > > > </ns1:add> >> > > > > > XML; >> > > > > > try { >> > > > > > $my_cert = ws_get_cert_from_file('alice_cert.cert'); // client >> > side >> > > > > > certificate( public key) >> > > > > > $my_key = ws_get_key_from_file('alice_key.pem'); // client >> > side key >> > > > > > $rec_cert = ws_get_cert_from_file('bob_cert.cert'); // > server side >> > > > > > certificate (public key ) >> > > > > > >> > > > > > $reqMessage = new WSMessage($reqPayloadString, >> > > > > > >> > array('to'=>'http://localhost:8181/axis2/services/Math','action' => >> > > > > > 'urn:add')); >> > > > > > >> > > > > > >> > > > > > $sec_token = new WSSecurityToken(array('privateKey' => $my_key, >> > > > > > 'certificate' => $my_cert, >> > > > > > 'receiverCertificate' => $rec_cert, >> > > > > > 'ttl'=> 60)); >> > > > > > $policy_xml = file_get_contents('policy.xml'); >> > > > > > $policy = new WSPolicy($policy_xml); >> > > > > > >> > > > > > >> > > > > > $client = new WSClient(array('useWSA' => TRUE, >> > > > > > 'policy' => $policy, >> > > > > > 'securityToken' => $sec_token)); >> > > > > > >> > > > > > $resMessage = $client->request($reqMessage); >> > > > > > >> > > > > > printf('Response = %s \n', $resMessage->str); >> > > > > > } catch (Exception $e) { >> > > > > > if ($e instanceof WSFault) { >> > > > > > printf('Soap Fault: %s\n', $e->Reason); >> > > > > > } else { >> > > > > > printf('Message = %s\n',$e->getMessage()); >> > > > > > } >> > > > > > } >> > > > > > ?> >> > > > > > >> > > > > > i have been trying non-stop just to get encryption and signature >> > > > > > working :(, but i keep getting errors, if anyone has a working >> > sample >> > > > > > please can i see it? or if anyone knows the reason for this > error >> > > > > > please let me know. thanks >> > > > > > >> > > > > > >> > > > >> > ------------------------------------------------------------------------ >> > > > > > Do you know a place like the back of your hand? Share local >> > knowledge >> > > > > > with BackOfMyHand.com <http://www.backofmyhand.com> >> > > > > > >> > > > >> > ------------------------------------------------------------------------ >> > > > > > >> > > > > > <service name='Math' scope='application'> >> > > > > > <description> >> > > > > > MathService >> > > > > > </description> >> > > > > > >> > > > > > >> > > > > > >> > > > > > <messageReceivers> >> > > > > > >> > > > > > <messageReceiver >> > > > > > mep='http://www.w3.org/2004/08/wsdl/in-out' >> > > > > > class='org.apache.axis2.rpc.receivers.RPCMessageReceiver'/> >> > > > > > >> > > > > > <messageReceiver >> > > > > > mep='http://www.w3.org/2004/08/wsdl/in-out' >> > > > > > class='org.apache.axis2.rpc.receivers.RPCMessageReceiver'/> >> > > > > > >> > > > > > <messageReceiver >> > > > > > mep='http://www.w3.org/2004/08/wsdl/in-out' >> > > > > > class='org.apache.axis2.rpc.receivers.RPCMessageReceiver'/> >> > > > > > >> > > > > > <messageReceiver >> > > > > > mep='http://www.w3.org/2004/08/wsdl/in-out' >> > > > > > class='org.apache.axis2.rpc.receivers.RPCMessageReceiver'/> >> > > > > > </messageReceivers> >> > > > > > >> > > > > > >> > > > > > >> > > > > > <parameter name='ServiceClass'> >> > > > > > math.Math >> > > > > > </parameter> >> > > > > > >> > > > > > <module ref='rampart' /> >> > > > > > <module ref='addressing' /> >> > > > > > >> > > > > > <wsp:Policy wsu:Id='SigEncr' >> > > > >> > > xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd' > >> > >> > > > xmlns:wsp='http://schemas.xmlsoap.org/ws/2004/09/policy'> >> > > > > > <wsp:ExactlyOne> >> > > > > > <wsp:All> >> > > > > > <sp:AsymmetricBinding >> > > > xmlns:sp='http://schemas.xmlsoap.org/ws/2005/07/securitypolicy'> >> > > > > > <wsp:Policy> >> > > > > > <sp:InitiatorToken> >> > > > > > <wsp:Policy> >> > > > > > <sp:X509Token >> > > > >> > > sp:IncludeToken='http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient'> >> > > > > > <wsp:Policy> >> > > > > > <sp:WssX509V3Token10/> >> > > > > > </wsp:Policy> >> > > > > > </sp:X509Token> >> > > > > > </wsp:Policy> >> > > > > > </sp:InitiatorToken> >> > > > > > <sp:RecipientToken> >> > > > > > <wsp:Policy> >> > > > > > <sp:X509Token >> > > > >> > > sp:IncludeToken='http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never'> >> > > > > > <wsp:Policy> >> > > > > > <sp:WssX509V3Token10/> >> > > > > > </wsp:Policy> >> > > > > > </sp:X509Token> >> > > > > > </wsp:Policy> >> > > > > > </sp:RecipientToken> >> > > > > > <sp:AlgorithmSuite> >> > > > > > <wsp:Policy> >> > > > > > <sp:TripleDesRsa15/> >> > > > > > </wsp:Policy> >> > > > > > </sp:AlgorithmSuite> >> > > > > > <sp:Layout> >> > > > > > <wsp:Policy> >> > > > > > <sp:Strict/> >> > > > > > </wsp:Policy> >> > > > > > </sp:Layout> >> > > > > > <sp:IncludeTimestamp/> >> > > > > > <sp:OnlySignEntireHeadersAndBody/> >> > > > > > </wsp:Policy> >> > > > > > </sp:AsymmetricBinding> >> > > > > > <sp:Wss10 >> > > > xmlns:sp='http://schemas.xmlsoap.org/ws/2005/07/securitypolicy'> >> > > > > > <wsp:Policy> >> > > > > > <sp:MustSupportRefKeyIdentifier/> >> > > > > > <sp:MustSupportRefIssuerSerial/> >> > > > > > </wsp:Policy> >> > > > > > </sp:Wss10> >> > > > > > <sp:SignedParts >> > > > xmlns:sp='http://schemas.xmlsoap.org/ws/2005/07/securitypolicy'> >> > > > > > <sp:Body/> >> > > > > > </sp:SignedParts> >> > > > > > <sp:EncryptedParts >> > > > xmlns:sp='http://schemas.xmlsoap.org/ws/2005/07/securitypolicy'> >> > > > > > <sp:Body/> >> > > > > > </sp:EncryptedParts> >> > > > > > >> > > > > > <ramp:RampartConfig >> > xmlns:ramp='http://ws.apache.org/rampart/policy'> >> > > > > > <ramp:user>service</ramp:user> >> > > > > > <ramp:encryptionUser>client</ramp:encryptionUser> >> > > > > > >> > > > >> > > <ramp:passwordCallbackClass>math.PWCBHandler</ramp:passwordCallbackClass> >> > > > > > >> > > > > > <ramp:signatureCrypto> >> > > > > > <ramp:crypto >> > > > provider='org.apache.ws.security.components.crypto.Merlin'> >> > > > > > <ramp:property >> > > > >> > > name='org.apache.ws.security.crypto.merlin.keystore.type'>JKS</ramp:property> >> > > > > > <ramp:property >> > > > >> > > name='org.apache.ws.security.crypto.merlin.file'>service.jks</ramp:property> >> > > > > > <ramp:property >> > > > >> > > name='org.apache.ws.security.crypto.merlin.keystore.password'>apache</ramp:property> >> > > > > > </ramp:crypto> >> > > > > > </ramp:signatureCrypto> >> > > > > > <ramp:encryptionCypto> >> > > > > > <ramp:crypto >> > > > provider='org.apache.ws.security.components.crypto.Merlin'> >> > > > > > <ramp:property >> > > > >> > > name='org.apache.ws.security.crypto.merlin.keystore.type'>JKS</ramp:property> >> > > > > > <ramp:property >> > > > >> > > name='org.apache.ws.security.crypto.merlin.file'>service.jks</ramp:property> >> > > > > > <ramp:property >> > > > >> > > name='org.apache.ws.security.crypto.merlin.keystore.password'>apache</ramp:property> >> > > > > > </ramp:crypto> >> > > > > > </ramp:encryptionCypto> >> > > > > > </ramp:RampartConfig> >> > > > > > >> > > > > > </wsp:All> >> > > > > > </wsp:ExactlyOne> >> > > > > > </wsp:Policy> >> > > > > > >> > > > > > >> > > > > > </service> >> > > > > > >> > > > >> > ------------------------------------------------------------------------ >> > > > > > >> > > > > > <?xml version='1.0' encoding='UTF-8'?> >> > > > > > <!-- >> > > > > > ! >> > > > > > ! Copyright 2006 The Apache Software Foundation. >> > > > > > ! >> > > > > > ! Licensed under the Apache License, Version 2.0 (the > 'License'); >> > > > > > ! you may not use this file except in compliance with the > License. >> > > > > > ! You may obtain a copy of the License at >> > > > > > ! >> > > > > > ! http://www.apache.org/licenses/LICENSE-2.0 >> > > > > > ! >> > > > > > ! Unless required by applicable law or agreed to in writing, >> > software >> > > > > > ! distributed under the License is distributed on an 'AS IS' >> > BASIS, >> > > > > > ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either > express or >> > > > implied. >> > > > > > ! See the License for the specific language governing >> > permissions and >> > > > > > ! limitations under the License. >> > > > > > !--> >> > > > > > >> > > > > > <wsp:Policy wsu:Id='SigEncr' >> > > > >> > > xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd' > >> > >> > > > xmlns:wsp='http://schemas.xmlsoap.org/ws/2004/09/policy'> >> > > > > > <wsp:ExactlyOne> >> > > > > > <wsp:All> >> > > > > > <sp:AsymmetricBinding >> > > > xmlns:sp='http://schemas.xmlsoap.org/ws/2005/07/securitypolicy'> >> > > > > > <wsp:Policy> >> > > > > > <sp:InitiatorToken> >> > > > > > <wsp:Policy> >> > > > > > <sp:X509Token >> > > > >> > > sp:IncludeToken='http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient'> >> > > > > > <wsp:Policy> >> > > > > > <sp:WssX509V3Token10/> >> > > > > > </wsp:Policy> >> > > > > > </sp:X509Token> >> > > > > > </wsp:Policy> >> > > > > > </sp:InitiatorToken> >> > > > > > <sp:RecipientToken> >> > > > > > <wsp:Policy> >> > > > > > <sp:X509Token >> > > > >> > > sp:IncludeToken='http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never'> >> > > > > > <wsp:Policy> >> > > > > > <sp:WssX509V3Token10/> >> > > > > > </wsp:Policy> >> > > > > > </sp:X509Token> >> > > > > > </wsp:Policy> >> > > > > > </sp:RecipientToken> >> > > > > > <sp:AlgorithmSuite> >> > > > > > <wsp:Policy> >> > > > > > <sp:TripleDesRsa15/> >> > > > > > </wsp:Policy> >> > > > > > </sp:AlgorithmSuite> >> > > > > > <sp:Layout> >> > > > > > <wsp:Policy> >> > > > > > <sp:Strict/> >> > > > > > </wsp:Policy> >> > > > > > </sp:Layout> >> > > > > > <sp:IncludeTimestamp/> >> > > > > > <sp:OnlySignEntireHeadersAndBody/> >> > > > > > </wsp:Policy> >> > > > > > </sp:AsymmetricBinding> >> > > > > > <sp:Wss10 >> > > > xmlns:sp='http://schemas.xmlsoap.org/ws/2005/07/securitypolicy'> >> > > > > > <wsp:Policy> >> > > > > > <sp:MustSupportRefKeyIdentifier/> >> > > > > > <sp:MustSupportRefIssuerSerial/> >> > > > > > </wsp:Policy> >> > > > > > </sp:Wss10> >> > > > > > <sp:SignedParts >> > > > xmlns:sp='http://schemas.xmlsoap.org/ws/2005/07/securitypolicy'> >> > > > > > <sp:Body/> >> > > > > > </sp:SignedParts> >> > > > > > <sp:EncryptedParts >> > > > xmlns:sp='http://schemas.xmlsoap.org/ws/2005/07/securitypolicy'> >> > > > > > <sp:Body/> >> > > > > > </sp:EncryptedParts> >> > > > > > >> > > > > > <ramp:RampartConfig >> > xmlns:ramp='http://ws.apache.org/rampart/policy'> >> > > > > > <ramp:user>client</ramp:user> >> > > > > > <ramp:encryptionUser>service</ramp:encryptionUser> >> > > > > > >> > > > >> > > <ramp:passwordCallbackClass>math.PWCBHandler</ramp:passwordCallbackClass> >> > > > > > >> > > > > > <ramp:signatureCrypto> >> > > > > > <ramp:crypto >> > > > provider='org.apache.ws.security.components.crypto.Merlin'> >> > > > > > <ramp:property >> > > > >> > > name='org.apache.ws.security.crypto.merlin.keystore.type'>JKS</ramp:property> >> > > > > > <ramp:property >> > > > >> > > name='org.apache.ws.security.crypto.merlin.file'>client.jks</ramp:property> >> > > > > > <ramp:property >> > > > >> > > name='org.apache.ws.security.crypto.merlin.keystore.password'>apache</ramp:property> >> > > > > > </ramp:crypto> >> > > > > > </ramp:signatureCrypto> >> > > > > > <ramp:encryptionCypto> >> > > > > > <ramp:crypto >> > > > provider='org.apache.ws.security.components.crypto.Merlin'> >> > > > > > <ramp:property >> > > > >> > > name='org.apache.ws.security.crypto.merlin.keystore.type'>JKS</ramp:property> >> > > > > > <ramp:property >> > > > >> > > name='org.apache.ws.security.crypto.merlin.file'>client.jks</ramp:property> >> > > > > > <ramp:property >> > > > >> > > name='org.apache.ws.security.crypto.merlin.keystore.password'>apache</ramp:property> >> > > > > > </ramp:crypto> >> > > > > > </ramp:encryptionCypto> >> > > > > > </ramp:RampartConfig> >> > > > > > >> > > > > > </wsp:All> >> > > > > > </wsp:ExactlyOne> >> > > > > > </wsp:Policy> >> > > > > > >> > > > > > >> > > > >> > ------------------------------------------------------------------------ >> > > > > > >> > > > > > _______________________________________________ >> > > > > > Wsf-php-user mailing list >> > > > > > [EMAIL PROTECTED] >> > > > > > http://wso2.org/cgi-bin/mailman/listinfo/wsf-php-user >> > > > > > >> > > > > >> > > > > >> > > > > -- >> > > > > http://kaushalye.blogspot.com/ >> > > > > http://wso2.org/ >> > > > > >> > > > >> > > > >> > > > >> > ------------------------------------------------------------------------ >> > > > Get free emoticon packs and customisation from Windows Live. Pimp My >> > > > Live! <http://www.pimpmylive.co.uk> >> > > > >> > ------------------------------------------------------------------------ >> > > > >> > > > _______________________________________________ >> > > > Wsf-php-user mailing list >> > > > [EMAIL PROTECTED] >> > > > http://wso2.org/cgi-bin/mailman/listinfo/wsf-php-user >> > > > >> > > >> > > >> > > -- >> > > http://kaushalye.blogspot.com/ >> > > http://wso2.org/ >> > > >> > > >> > > _______________________________________________ >> > > Wsf-php-user mailing list >> > > [EMAIL PROTECTED] >> > > http://wso2.org/cgi-bin/mailman/listinfo/wsf-php-user >> > >> > >> > ------------------------------------------------------------------------ >> > Are you the Quizmaster? Play BrainBattle with a friend now! >> > <http://specials.uk.msn.com/brainbattle> >> > ------------------------------------------------------------------------ >> > >> > _______________________________________________ >> > Wsf-php-user mailing list >> > [EMAIL PROTECTED] >> > http://wso2.org/cgi-bin/mailman/listinfo/wsf-php-user >> > >> >> >> -- >> http://kaushalye.blogspot.com/ >> http://wso2.org/ >> > > > ------------------------------------------------------------------------ > Play Movie Mash-up and win BIG prizes! <https://www.moviemashup.co.uk> >
signature.asc
Description: OpenPGP digital signature
