0 Replies Latest reply: Jul 6, 2012 6:39 AM by 945123 RSS

    OC4J client with WCF Web Service using Mutual Certificates

    945123
      I'm trying to generate client stubs for a WCF web service.
      I tried using docs here:
      http://docs.oracle.com/cd/B10464_05/web.904/b10447/tools.htm

      # OC4J 9.0.4
      Java sdk 1.4.2_03

      cd \dev\oc4j-9.0.4\webservices\lib
      - config.xml
      <?xml version="1.0"?>
      <web-service>
      <proxy-gen>
      <proxy-dir>output/clientclass/examples/webservices/simple_client</proxy-dir>
      <option name="include-source">true</option>
      <option name="wsdl-location">
      http://xxx.xxxxx.xxx:9000/WCFTestService/Service.svc?wsdl</option>
      </proxy-gen>
      </web-service>


      java -jar WebServicesAssembler.jar -debug
      - ends with NullPointerException:
      <output>
           Please wait ...
           ..parsing top level elements
           ..generating client side proxy for wsdl :
                          http://xxx.xxxxx.xxx:9000/WCFTestService/Service.svc?wsdl
           ....compiling client side proxy for package :proxy
           Exception in thread "main" java.lang.NullPointerException
                               at oracle.j2ee.ws.tools.WsAssmProxyGenerator.doCompile(WsAssmProxyGenerator.java:284)
                               at oracle.j2ee.ws.tools.WsAssmProxyGenerator.processProxy(WsAssmProxyGenerator.java:135)
                               at oracle.j2ee.ws.tools.WsAssmProxyGenerator.clientGenerate(WsAssmProxyGenerator.java:112)
                               at oracle.j2ee.ws.tools.WsAssembler.assemble(WsAssembler.java:96)
                               at oracle.j2ee.ws.tools.WsAssembler.main(WsAssembler.java:54)
      </output>

      - Then tried using Sun jdk to gen proxy:
      # Just SDK
      Java sdk 1.6.0_25

      wsimport -keep -extension -d output -s src -p examples.webservices http://xxx.xxxxx.xxx:9000/WCFTestService/Service.svc?wsdl

      <ListOfGeneratedJavaFiles>
      CompositeType.java
      GetData.java
      GetDataResponse.java
      GetDataUsingDataContract.java
      GetDataUsingDataContractResponse.java
      IService.java
      ObjectFactory.java
      package-info.java
      Service.java
      </ListOfGeneratedJavaFiles>

      - creates the service and port, but where is the stub?
      in my code I use the stub to set the certificate auth
           <codeSnip>
           // get the ws stub
           IService_Stub serviceStub = (IService_Stub)iSampleService;

           // add the credential providers to the ws stub
           serviceStub._setProperty(WSSecurityContext.CREDENTIAL_PROVIDER_LIST,
                                                        credProviders);
           </codeSnip>

      # WebLogic 10.3.5
      I'm happy to say that everything seems to work well under WebLogic 10.3.5.
      I used weblogic.wsee.tools.anttasks.ClientGenTask with ant
      to generate the proxy files.

      <ListOfGeneratedJavaFiles>
      IService.java
      IService_Stub.java
      Service.java
      Service_Impl.java
      </ListOfGeneratedJavaFiles>

      I understand how to use these files and everything works.
      But we need this to work in the OC4J orion server before we are ready to upgrade to WebLogic.
      I have also tried OC4J 10.1.2.0.2 - same a OC4j 9.0.4 - null pointer.
      I also tried Metro, but it uses wsimport, so also does not have a stub.
      I'm out of ideas. Any pointers or advice are greatly appreciated.
      Thank you.