1
votes

I have developed my webservice in Java CXF which returns java.util.List. This webservice is password enabled. that means i have used org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor for security purpose.

Now i want to call this webservice from php. but i am not able to do so. Without security settings i am able to access my webservice using nusoap. but when i enabled security feture (interceptor) in webservice, i am getting error like ns1:InvalidSecurity An error was discovered processing the header

and i am getting response as follows:

HTTP/1.1 500 Internal Server Error Server: Apache-Coyote/1.1 Content-Type: text/xml;charset=ISO-8859-1 Content-Length: 361 Date: Fri, 18 Jun 2010 08:53:54 GMT Connection: close

< soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">< soap:Body>< soap:Fault>< faultcode xmlns:ns1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" > ns1:InvalidSecurity< /faultcode>< faultstring>An error was discovered processing the <wsse:Security > header< /faultstring>< /soap:Fault>< /soap:Body>

any help will be appriciated thanks in advance Darpan Desai

1

1 Answers

3
votes

I got the answer myself. just have to include following code. And it will add ws-security in nusoap.

$header = '< wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                    < wsse:UsernameToken>
                    < wsse:Username>UserName</wsse:Username>
                    < wsse:Password>Password</wsse:Password>
                    < /wsse:UsernameToken>
                    < /wsse:Security>';

$result = $client->call('yourMethodName',$param,$namespace,$soapAction,$header);