cancel
Showing results for 
Search instead for 
Did you mean: 

Security for a web service

david_fryda2
Participant
0 Kudos

Hi everyone,

Scenario :

I want to securise a web service with SSL.

I want to call this web service with Java standalone class (not servlet, JSP,...).

Here is what I've done :

1) I created a web service with "Secure SOAP" option.

2) I created a <u>Standalone Proxy</u>.

3) I created a Java Standalone client and tried to call the web service.

Here is the code :

public static void main(String[] args) {

try {

Hello1WebServiceImpl service = new Hello1WebServiceImpl();

Hello1WebServiceViDocument port = (Hello1WebServiceViDocument)service.getLogicalPort();

System.out.println(port.sayHello1());

} catch (Exception e) {

e.printStackTrace();

}

}

Here is the exception :

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

java.net.ConnectException: Connection timed out: connect

at com.proxy.Config1BindingStub.sayHello1(Config1BindingStub.java:80)

at com.proxy.Config1BindingStub.sayHello1(Config1BindingStub.java:88)

at SampleComponent.main(SampleComponent.java:23)

Caused by: java.net.ConnectException: Connection timed out: connect

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)

at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)

at java.net.Socket.connect(Socket.java:452)

at java.net.Socket.connect(Socket.java:402)

at java.net.Socket.<init>(Socket.java:309)

at java.net.Socket.<init>(Socket.java:124)

at iaik.security.ssl.SSLSocket.<init>(Unknown Source)

at com.sap.engine.services.webservices.jaxm.soap.SSLUtilImpl.createSSLSocket(SSLUtilImpl.java:43)

at com.sap.engine.services.webservices.jaxm.soap.HTTPSocket.initStreamsFromSocket(HTTPSocket.java:500)

at com.sap.engine.services.webservices.jaxm.soap.HTTPSocket.initializeStreams(HTTPSocket.java:422)

at com.sap.engine.services.webservices.jaxm.soap.HTTPSocket.getOutputStream(HTTPSocket.java:384)

at com.sap.engine.services.webservices.jaxrpc.wsdl2java.soapbinding.HTTPTransport.getRequestStream(HTTPTransport.java:337)

at com.sap.engine.services.webservices.jaxrpc.wsdl2java.soapbinding.MimeHttpBinding.outputMessage(MimeHttpBinding.java:433)

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

at com.proxy.Config1BindingStub.sayHello1(Config1BindingStub.java:73)

... 2 more

Can someone please tell me the steps I must follow ?

Thanks in advance.

Message was edited by: David Fryda

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

David,

No, I have not worked with stand alone proxys -- however if they are independent of the J2EE server ie you can call the exicutable (java -options) as indicated by having a main function, the J2EE server should not play a role. Where is this helo web service wsdl that you are using? does it work without going over https? is it a valid service?

david_fryda2
Participant
0 Kudos

Hi Roger,

My web service does work without https.

This web service is located on the server.

I did call the web service via standalone proxy.

How can I call this web service with SSL ?

Is it possible with standalone proxy ?

Thanks

Former Member
0 Kudos

Ive ran into similar proples using normal ssl over http and the issues were with my environmet configuration ... yours may be with somthing totally different... but i fixed my probs by adding the folling code before creating the connection.

java.security.Provider provider[] =

java.security.Security.getProviders();

for (int i = 0; i < provider.length; i++) {

java.security.Security.removeProvider(

provider<i>.getName());

}

java.security.Security.insertProviderAt(

new com.sun.net.ssl.internal.ssl.Provider(), 2);

java.security.Security.insertProviderAt(

new sun.security.provider.Sun(), 1);

System.setProperty(

"java.protocol.handler.pkgs",

"com.sun.net.ssl.internal.www.protocol");

you can also accomplish this by modifying the java.security file found in \jre\lib\security directory. Also because this is a stand alone app be sure to have all the necessary jar files in you classpath ... you can accomplish this by using the -classpath option when calling your program or by moving the files into you \bin\lib\ext directory;

david_fryda2
Participant
0 Kudos

Hi Roger,

So you confirm me that you was able to call a web service with SSL via a Standalone Proxy ?

Did you configure something in the Visual Administrator console ?

Thanks.