Axis2 webservice client weblogic webservice client jar confilct - web-services

My application is a war deployed in weblogic 10. In one of my class, I need to make 2 webservice calls A and W. A is based on AXIS2 using wstx-asl-3.2.4.jar, W is based on weblogic webservice using jars in weblogic. I guess due to the conflict between wstx-asl and weblogic stax implementation, they can not be made at the same time.
Here is the detail of the problem:
1. If I remove wstx-asl-3.2.4.jar from web-inf/lib folder,
B is OK but A is faild due to exception: ClassCastException:weblogic.xml.stax.XMLStreamInputFactory
2. If I keep wstx-asl-3.2.4.jar in web-inf/lib folder,
A is OK but B is faild due to the exception:
[java.lang.ExceptionInInitializerError at com.bea.staxb.runtime.internal.BindingContextImpl.createMarshaller(BindingContextImpl.java:65) at weblogic.wsee.bind.runtime.internal.LiteralSerializerContext.(LiteralSerializerContext.java:54) at weblogic.wsee.bind.runtime.internal.RuntimeBindingsImpl.createSerializerContext(RuntimeBindingsImpl.java:152) at weblogic.wsee.bind.runtime.internal.RuntimeBindingsImpl.createSerializerContext(RuntimeBindingsImpl.java:168) at weblogic.wsee.codec.soap11.SerializationContextUtil.createSerializerContext(SerializationContextUtil.java:26) at weblogic.wsee.codec.soap11.SoapEncoder.encodeParts(SoapEncoder.java:179) at weblogic.wsee.codec.soap11.SoapEncoder.encode(SoapEncoder.java:119) at weblogic.wsee.codec.soap11.SoapCodec.encode(SoapCodec.java:128) at weblogic.wsee.ws.dispatch.client.CodecHandler.encode(CodecHandler.java:52) at weblogic.wsee.ws.dispatch.client.CodecHandler.handleRequest(CodecHandler.java:41) at weblogic.wsee.handler.HandlerIterator.handleRequest(HandlerIterator.java:123) at weblogic.wsee.handler.HandlerIterator.handleRequest(HandlerIterator.java:99) at weblogic.wsee.ws.dispatch.client.ClientDispatcher.dispatch(ClientDispatcher.java:101) at weblogic.wsee.ws.WsStub.invoke(WsStub.java:89) at weblogic.wsee.jaxrpc.StubImpl._invoke(StubImpl.java:331) at
.........................
Please advise how to make them successful together. Thanks.

in your deployment weblogic.xml file, use the <prefer-web-inf-classes> tag and set it to true for the axis2 call. And set it to false for the weblogic web service.
http://download.oracle.com/docs/cd/E13222_01/wls/docs90/programming/classloading.html#1082452

Related

Assembling a WebLogic Web Service Manually

I implemented webservice as described in this guide by simply creating "web-services.xml" with the following content (and offcourse i create the 'com.example.WorkFlowEntry' handler class ) :
<web-services>
<handler-chains>
<handler-chain name="enterWorkflowChain">
<handler class-name="com.example.WorkFlowEntry">
<init-params>
<init-param name="workflow-eng-jndi-name"
value="workflow.entry" />
</init-params>
</handler>
</handler-chain>
</handler-chains>
<web-service targetNamespace="http://example.com"
name="myworkflow" uri="myWorkflowService">
<operations xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<operation name="enterWorkflow"
handler-chain="enterWorkflowChain"
invocation-style="one-way" />
</operations>
</web-service>
My issue is that when i deploy the EAR file in weblogic 11g the '' webservice is deployed successfully and i can access the WSDL of the webservice. When i deploy the same EAR in weblogic 12c it got deployed successfully but the WSDL is not accessible i am getting 404!
Manually assembling weblogic web service is valid if you are using the
Webservice 8.1 environment. The last Weblogic version for which this
approach can be used is Weblogic 12.1.1, from Weblogic 12.1.2 release,
the 8.1 WebLogic Web services run time has been removed.
that means using the 'web-services.xml' to build your webservice is valid till weblogic 12.1.1 version. for the newer version you have to upgrade your webservice implementation as mentioned in this link which mainly go through (Upgrading a 10.x WebLogic Web Service (JAX-WS or JAX-RPC) to 12.1.x). But this solution may affect the current running clients.
In my case i cannot ask the client to change their code. So my workaround for this case is to take the current WSDL and generate the webservice manually by ant as described in this link which is describes using wsdlc Ant task to generate the following artifacts:
JWS service endpoint interface (SEI) that implements the Web service described
by the WSDL file.
JWS implementation file that contains a partial (stubbed-out) implementation of
the generated JWS SEI. This file must be customized by the developer.
JAXB data binding artifacts.
Optional Javadocs for the generated JWS SEI.

Soap message name space issue on tomcat server

Hi I have a problem for quite some time that I can not solve. When I run my application on STS spring with spring run boot command, everything works fine. But if I try to deploy application on tomcat, everything works except the addition of a namespace to a soap message that reject the call to the soap service.
I insert below correct soap message on spring boot and follow the wrong message on tomcat.
SPING BOOT SUCCESS SOAP MSG:
<RetrieveDocumentSetRequest
xmlns="urn:ihe:iti:xds-b:2007"
xmlns:ns2="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0"
xmlns:ns3="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"
xmlns:ns4="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0"
xmlns:ns5="urn:oasis:names:tc:ebxml-regrep:xsd:query:3.0">
<DocumentRequest>
<RepositoryUniqueId>2.16.840.1.113883.2.9.2.999.4.5.113883</RepositoryUniqueId>
<DocumentUniqueId>2.16.840.1.113883.2.9.2.999.4.4^123456</DocumentUniqueId></DocumentRequest>
</RetrieveDocumentSetRequest>
TOMCAT 7 FAIL SOAP MSG:
<ns6:RetrieveDocumentSetRequest
xmlns:ns2="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0"
xmlns:ns3="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"
xmlns:ns4="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0"
xmlns:ns5="urn:oasis:names:tc:ebxml-regrep:xsd:query:3.0"
xmlns:ns6="urn:ihe:iti:xds-b:2007">
<DocumentRequest><RepositoryUniqueId>2.16.840.1.113883.2.9.2.999.4.5.113883</RepositoryUniqueId>
<DocumentUniqueId>2.16.840.1.113883.2.9.2.999.4.4^123456</DocumentUniqueId>
</DocumentRequest>
</ns6:RetrieveDocumentSetRequest>
As you can see messages are almost same except for n6 namespace. I can't understand why and if there is a wrong Jar on tomcat respect to springboot sever.
I have solved my problem.
The generator classes specified in the pom.xml of spring boot, using JAXB to generate classes from the interface WSDL, while the Jar that use and release of tomcat, using jax-ws library for generations of classes starting from WSDL.
The first library, JAXB, insert the annotation regarding the namespace, both on classes properties and inner classes of the generated classes. All this does not happen when using jax-ws, but only for some classes. This thing even if at first sight irrelevant, creates an answer rejected by the validator server side, the SOAP request sent.
I hope it will help someone in the future.

Consuming webservice from application deployed on websphere

I have been trying to consume a webservice(WS-JAX) in java.
I have generated JAVA artifacts using wsimport tool. I constructed a standalone test class(on eclipse) and was able to call the webservice successfully.
But when I use the same actifacts and code in my application(deployed on websphere 8) I get below exception
`
[2/5/16 10:54:13:531 MST] FFDC Exception:java.lang.StackOverflowError SourceId:com.ibm.ejs.container.RemoteExceptionMappingStrategy.setUncheckedException ProbeId:200 Reporter:com.ibm.ejs.container.RemoteExceptionMappingStrategy#625fad44
java.lang.StackOverflowError
at java.util.HashMap.<init>(HashMap.java:367)
at com.ibm.wsdl.DefinitionImpl.getAllServices(DefinitionImpl.java:859)
at com.ibm.wsdl.DefinitionImpl.getAllServices(DefinitionImpl.java:873)
at org.apache.axis2.wsdl.util.WSDLWrapperReloadImpl.getAllServices(WSDLWrapperReloadImpl.java:903)
at org.apache.axis2.wsdl.util.WSDLDefinitionWrapper.getAllServices(WSDLDefinitionWrapper.java:478)
at com.ibm.wspolicy.wsdl.internal.subject.DefinitionSubjectProcessor.<init>(DefinitionSubjectProcessor.java:60)
at com.ibm.wspolicy.wsdl.internal.WSDLProcessorImpl.buildWSDLPolicyModel(WSDLProcessorImpl.java:79)
at com.ibm.ws.wspolicy.wsdl.WSDLProcessor.<init>(WSDLProcessor.java:137)
at com.ibm.ws.wspolicy.policyset.WSDLHelperImpl.processWSPolicyInPackagedWSDL(WSDLHelperImpl.java:80)
at com.ibm.ws.websvcs.deployment.WASAxis2PolicySetConfigurator.associatePolicySets(WASAxis2PolicySetConfigurator.java:385)
at com.ibm.ws.websvcs.client.WSClientConfigurationFactory.completeAxis2Configuration(WSClientConfigurationFactory.java:459)
at org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.<init>(EndpointDescriptionImpl.java:286)
at org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.<init>(EndpointDescriptionImpl.java:223)
at org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.updateEndpointDescription(ServiceDescriptionImpl.java:534)
at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.updateEndpoint(DescriptionFactoryImpl.java:382)
at org.apache.axis2.jaxws.description.DescriptionFactory.updateEndpoint(DescriptionFactory.java:180)
at org.apache.axis2.jaxws.spi.ServiceDelegate.getPort(ServiceDelegate.java:597)
at org.apache.axis2.jaxws.spi.ServiceDelegate.getPort(ServiceDelegate.java:513)
at javax.xml.ws.Service.getPort(Service.java:99)`
Could someone shed some light on why the webservice call is failing when it is originating inside a application server?
Note: I have installed proper server certificates in the application server truststore.
So i found the solution, I had 2 different JRE's installed on my computer. One was from Oracle and the other was the jre bundled with websphere application server. For a application to be deployed on Websphere we have to generate the java artifacts using the IBM jre thats bundled with Websphere.
Thanks,
Harsha

WSO2 ESB Identity Server and Web Service Client

I'm refering to the following article
http://wso2.com/library/articles/2010/10/using-xacml-fine-grained-authorization-wso2-platform/
I would like to use the sample echoService from the WSO2 AS over a secured proxy in WSO2 ESB in combination with the Identity Server for fine-grained authorization. All the settings mentioned on this page seem to work, however I am stuck concerning the client part. I use NetBeans and the given client code, but the .jars in the classpath there have older versions then the ones in the current version of WSO2 IS, so I started to exchange them manually. Now I get some exceptions like
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.xml.security.transforms.Transform.init()V
and I am stuck again. I just want to test the echoService in this constellation and send some string over the ESB via IS and receive the response(if I have the appropriate role) from the AS, is there not another client or how could I test it else?
Thank you!
I can suggest you 3 options:
Use SoapUI to test the service which is the easiest way to test a web service.
Generate the stub for the service and have stub as the dependency in your client. You can use the WSDL2Java tool that ship with AS. Loging to AS --> Tools in left pane --> WSDL2Java --> Provide the wsdl URL and generate the stub jar.
Generate correct dependency libs. Go to [IS-Home]/bin folder, and issue that command "ant" to run the build.xml, this will copy all required libs to [IS-HOME]/repository/lib/ folder. Have them in your class path.

GlassFish, set context-path of webservice

I have EAR with my web-service. No war module in my application.
I mean
http://[host]:[port]/[context-path]/MyWebService?wsdl
For JBoss I am using jboss.xml
For WebLogic I am using weblogic-webservices.xml
What about GlassFish?
It looks like this document says to use the endpoint-address-uri to set the context-root for your web service on GlassFish... That element would go into the glassfish-ejb-jar.xml file.