Skip to Content
0
Former Member
Dec 30, 2005 at 12:35 PM

Consuming a Web Service via SSL with Basic Authentication

468 Views

Hello,

I have a simple web service (returns a parameter value) and want to consume it. Therefore I have generated a proxy for its in Netweaver Studio SP13.

When I set up the web service to be accessed via HTTP and Basic Authentication (Username/Password), everything is fine. When I set up the web service to communicate via HTTPS, I get the following error message in my client:

java.rmi.RemoteException: Service call exception; nested exception is:

java.lang.NullPointerException

at priv.senw04.wsproxy.multisec_ssl.SSLBindingStub.pingText(SSLBindingStub.java:87)

at priv.senw04.wsproxy.multisec_ssl.SSLBindingStub.pingText(SSLBindingStub.java:96)

at priv.se.wsclient.MultiSecSSL.main(MultiSecSSL.java:38)

Caused by: java.lang.NullPointerException

at com.sap.engine.services.webservices.jaxm.soap.HTTPSocket.disconnect(HTTPSocket.java:625)

at com.sap.engine.services.webservices.jaxrpc.wsdl2java.soapbinding.HTTPTransport.closeSession(HTTPTransport.java:396)

at com.sap.engine.services.webservices.jaxrpc.wsdl2java.soapbinding.MimeHttpBinding.call(MimeHttpBinding.java:1312)

at priv.senw04.wsproxy.multisec_ssl.SSLBindingStub.pingText(SSLBindingStub.java:80)

... 2 more

Testing the web service with WebServiceNavigator and/or by using a generated WebDynpro Client results in the following error:

000D604C66BE004E0000001300000AFC00040922E0160632 : An error occurred during processing the timestamp. The error was: com.sap.security.core.ws.wss.NoSecurityHeaderException No wsse:Security header has been defined for role soap:finalActor. Please verify the policy configuration..

But my main focus is on the client implementation based on a proxy. Here comes the client's code:

public class MultiSecSSL {

public static void main(String[] args) {

try {

MultiSecuritySSLAuthImpl serviceInterface = new MultiSecuritySSLAuthImpl();

SSLBindingStub service = (SSLBindingStub)serviceInterface.getLogicalPort(MultiSecuritySSLAuthViDocument.class);

SecurityProtocol protocol = (SecurityProtocol) service._getGlobalProtocols().getProtocol("SecurityProtocol");

AuthenticationContext auth = protocol.getAuthenticationContext();

auth.setIgnoreSSLServerCertificate(true);

auth.setUsername("cfpcompany");

auth.setPassword("demo");

String ret = service.pingText("Called service MultiSecurity via SSL");

System.out.println(ret);

} catch (Exception e) {

e.printStackTrace(System.out);

}

}

}

Here comes the logical port information of the generated proxy:

<?xml version="1.0" encoding="UTF-8"?>

<LogicalPorts Name='MultiSecuritySSLAuth' InterfaceName='priv.senw04.wsproxy.multisec_ssl.MultiSecuritySSLAuth'>

<LogicalPort Name='SSLPort_Document' Endpoint='https://192.168.129.76:50001/MultiSecuritySSLAuth/SSL?style=document' BindingName='SSLBinding' BindingUri='urn:MultiSecuritySSLAuthWsd/SSL/document' BindingImplementation='SOAP 1.1 HTTP Binding with Attachments' StubName='priv.senw04.wsproxy.multisec_ssl.SSLBindingStub' Default='true' InterfaceName='priv.senw04.wsproxy.multisec_ssl.MultiSecuritySSLAuthViDocument' Original='true' Valid='true'>

<globalFeatures>

</Feature>

<Property Name='SessionMethod' Value='httpCookies'>

</Property>

</Feature>

<Property Name='AuthenticationLevel' Value='None'>

</Property>

<Property Name='AuthenticationMechanism' Value='HTTP'>

</Property>

<Property Name='AuthenticationMethod' Value='BasicAuth'>

</Property>

<Property Name='SupportsSSO2Authentication' Value='false'>

</Property>

</Feature>

<Property Name='Level' Value='No'>

</Property>

<Property Name='TLSType' Value='SSL'>

</Property>

</Feature>

</globalFeatures>

<localFeatures>

<Operation Name='pingText'>

<Property Name='RequestPolicy' Value='Signature'>

</Property>

<Property Name='ResponsePolicy' Value='None'>

</Property>

</Feature>

</Feature>

</Operation>

</localFeatures>

</LogicalPort>

</LogicalPorts>

To me, this looks consistent. Any idea, what is misconfigured on my machine ?