0 Replies Latest reply: Jul 3, 2014 9:10 AM by 1124720 RSS

    Standalone java client does not work when invoking ssl web service

    1124720

      hello to every one,

      I did an example webservice and configure the web service as one way SSL secured service with policy Wssp1.2-2007-Https.xml. The weblogic was configured with the demo truststore and identity, the service works very well.

      Then I created a webservice proxy using Jdeveloper and set the certification correctly, and also the client works well.

       

      However, now I want to create a standalone java client without any weblogic library. And generated the client code again using the wsimport, and configured the certificate files, my client code as follows:

       

      public final class WSTest_WSTestSoap12HttpPort_Client {

       

       

          private static final QName SERVICE_NAME = new QName("http://ws.ltfs.oracle/", "WSTestService");

       

       

          private WSTest_WSTestSoap12HttpPort_Client() {

          }

       

       

          public static void main(String args[]) throws java.lang.Exception {

      //     System.setProperty("java.protocol.handler.pkgs", "java.net");

          System.setProperty("javax.net.debug", "all");

          System.setProperty("javax.net.ssl.trustStore", "D:\\keystore\\DemoTrust.jks");

          System.setProperty("javax.net.ssl.trustStorePassword", "DemoTrustKeyStorePassPhrase");

              URL wsdlURL = WSTestService.WSDL_LOCATION;

              if (args.length > 0 && args[0] != null && !"".equals(args[0])) {

                  File wsdlFile = new File(args[0]);

                  try {

                      if (wsdlFile.exists()) {

                          wsdlURL = wsdlFile.toURI().toURL();

                      } else {

                          wsdlURL = new URL(args[0]);

                      }

                  } catch (MalformedURLException e) {

                      e.printStackTrace();

                  }

              }

              System.out.println(wsdlURL);

              HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {

       

        @Override

        public boolean verify(String arg0, SSLSession arg1) {

        System.out.println(arg0 + " vs. " + arg1.getPeerHost() );

        return true;

        }

        });

              WSTestService ss = new WSTestService(wsdlURL, SERVICE_NAME);

              WSTest port = ss.getWSTestSoap12HttpPort(); 

             

              {

              System.out.println("Invoking sayHello...");

              java.lang.String _sayHello_arg0 = "kevin";

              java.lang.String _sayHello__return = port.sayHello(_sayHello_arg0);

              System.out.println("sayHello.result=" + _sayHello__return);

       

              }

             System.exit(0);

          }

      }

       

       

       

      but it didn't work well, alway threw the exception:

      Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Unknown exception, internal system processing error.

        at com.sun.xml.internal.ws.fault.SOAP12Fault.getProtocolException(Unknown Source)

        at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(Unknown Source)

        at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)

        at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)

        at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)

        at com.sun.proxy.$Proxy29.sayHello(Unknown Source)

        at oracle.ws.ssl.WSTest_WSTestSoap12HttpPort_Client.main(WSTest_WSTestSoap12HttpPort_Client.java:72)

       

      Does anyone have the solution to invoke one way ssl web service deployed on weblogic using policy?

      or We must import the weblogic libraries?

       

      Many Thanks.