4 Replies Latest reply on Apr 12, 2011 12:35 PM by Pierluigi Vernetto

    Call OSB from java client

    Yatan
      Hi',

      I am trying to call OSB from java client,
      The OSB proxy Service type is "WSDL Web Service", I am able to get response from SOAP UI with below request, Please help me with Java code,
      I have been Googling a lot for this however didnt got enough.

      Thanks
      Yatan

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://core.xxx.com/schema/ServiceHeader/V1.0" xmlns:v11="http://core.xxx.com/schema/Customer/V1.0" xmlns:v12="http://core.xxx.com/schema/Customer/V1.0">
      <soapenv:Header>
      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsse:UsernameToken wsu:Id="UsernameToken-2" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <wsse:Username>weblogic</wsse:Username>
      <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">welcome1</wsse:Password>
      </wsse:UsernameToken>
      </wsse:Security>
      <v1:GMWSHeader>
      <v1:SourceId>String</v1:SourceId>
      <v1:TransactionId>String</v1:TransactionId>
      <v1:TransactionTimeStamp>1967-08-13</v1:TransactionTimeStamp>
      <v1:ServiceVersion>LATEST</v1:ServiceVersion>
      </v1:GMWSHeader>
      </soapenv:Header>
      <soapenv:Body>
      <v11:GetDetailsRequest>
      <v11:Condition>
      <v12:SellingSource>?</v12:SellingSource>
      <v12:FulfillingFCNNbr>?</v12:FulfillingFCNNbr>
      </v11:Condition>
      </v11:GetDetailsRequest>
      </soapenv:Body>
      </soapenv:Envelope>
        • 1. Re: Call OSB from java client
          Pierluigi Vernetto
          you can use http://axis.apache.org/axis2/java/core/docs/userguide-creatingclients.html

          or WebLogic clientgen.

          I have used Axis2 and it was fine. I vaguely remember it handles also the security aspect.
          1 person found this helpful
          • 2. Re: Call OSB from java client
            Eric Elzinga
            Or use the generate webservice proxy from jdeveloper, see : http://st-curriculum.oracle.com/obe/jdev/obe11jdev/ps1/webservices/ws.html#t5
            1 person found this helpful
            • 3. Re: Call OSB from java client
              Yatan
              Thanks Guys, I tried the ways you mentioned I am getting below error, this error is coming in both weblogic clientgen and webservice proxy from jdeveloper,
              I understand that this error has something to do with my process however not sure why is it coming, I will really appreciate if you can provide me some pointers.

              error:
              Buildfile: C:\JDeveloper\OSBClient\TestOSBClient\build.xml

              javaFromWSDL:
              [clientgen]
              *********** jax-ws clientgen attribute settings ***************

              wsdlURI: http://localhost:8001/xx/som/contracts/CustomerContract?wsdl
              packageName : com.osb.client
              destDir : C:\OSB

              *********** jax-ws clientgen attribute settings end ***************

              [clientgen] Consider using <depends>/<produces> so that wsimport won't do unnecessary compilation
              [clientgen] parsing WSDL...
              [clientgen]
              [clientgen]
              [clientgen] [ERROR] A class/interface with the same name "com.osb.client.SOMMessage" is already in use. Use a class customization to resolve this conflict.
              [clientgen] line 89 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
              [clientgen]
              [clientgen] [ERROR] (Relevant to above error) another "SOMMessage" is generated from here.
              [clientgen] line 51 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
              [clientgen]
              [clientgen] [ERROR] A class/interface with the same name "com.osb.client.TaskCompletionMessage" is already in use. Use a class customization to resolve this conflict.
              [clientgen] line 82 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
              [clientgen]
              [clientgen] [ERROR] (Relevant to above error) another "TaskCompletionMessage" is generated from here.
              [clientgen] line 76 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
              [clientgen]
              [clientgen] [ERROR] Two declarations cause a collision in the ObjectFactory class.
              [clientgen] line 89 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
              [clientgen]
              [clientgen] [ERROR] (Related to above error) This is the other declaration.
              [clientgen] line 51 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
              [clientgen]
              [clientgen] [ERROR] Two declarations cause a collision in the ObjectFactory class.
              [clientgen] line 82 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
              [clientgen]
              [clientgen] [ERROR] (Related to above error) This is the other declaration.
              [clientgen] line 76 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
              [clientgen]

              BUILD FAILED
              weblogic.wsee.tools.WsBuildException: Error running JAX-WS clientgen: null
                   at weblogic.wsee.tools.clientgen.jaxws.ClientGenImpl.execute(ClientGenImpl.java:175)
                   at weblogic.wsee.tools.anttasks.ClientGenFacadeTask.execute(ClientGenFacadeTask.java:244)
                   at weblogic.wsee.tools.anttasks.ClientGenTask.execute(ClientGenTask.java:365)
                   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                   at sun.reflect.DelegatinxxethodAccessorImpl.invoke(DelegatinxxethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:597)
                   at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
                   at org.apache.tools.ant.Task.perform(Task.java:348)
                   at org.apache.tools.ant.Target.execute(Target.java:357)
                   at org.apache.tools.ant.Target.performTasks(Target.java:385)
                   at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
                   at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
                   at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
                   at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
                   at org.apache.tools.ant.Main.runBuild(Main.java:758)
                   at org.apache.tools.ant.Main.startAnt(Main.java:217)
                   at org.apache.tools.ant.Main.start(Main.java:179)
                   at org.apache.tools.ant.Main.main(Main.java:268)
              Caused by: Error starting wsimport:
                   at com.sun.tools.ws.ant.WsImport2.execute(WsImport2.java:757)
                   at weblogic.wsee.tools.clientgen.jaxws.ClientGenImpl.execute(ClientGenImpl.java:169)
                   ... 19 more
              Caused by: com.sun.tools.ws.wscompile.AbortException
                   at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:136)
                   at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2255)
                   at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:194)
                   at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:140)
                   at com.sun.tools.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:261)
                   at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:203)
                   at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:188)
                   at com.sun.tools.ws.ant.WsImport2.execute(WsImport2.java:738)
                   ... 20 more

              Total time: 3 seconds
              • 4. Re: Call OSB from java client
                Pierluigi Vernetto
                duh?
                I see some documentation on this here http://download.oracle.com/docs/cd/E17802_01/webservices/webservices/docs/2.0/tutorial/doc/JAXBUsing4.html

                but I don't understand why your SOMMessage would already be used somewhere else.... unless there is some funny "import" in your WSDL which duplicates the definition of SOMMessage....

                can you post the entire WSDL and associated XSDs, if this is not too much a break of your privacy?