Axis2 : When to use Wsdd file with Axis2 Webservices - web-services

I am using Axis2 for developing webservices .
I started from WSDL file , and used WSDL2Java command line and generated all the sever related code (Skeltons) , wrote services.xml file , modified the skelton ( Implemented business logic in it ) and deployed as .aar file inside the Services folder of Axis2.war .
Now my question is
I have seen some examples using .wsdd file with Axis2 Webservices , i am really confused with this , please tell me do we need .wsdd file ??

Axis2 uses services.xml as the descriptor file.

You do not need to have .wsdd files with Axis2 - its been used in Axis..

In Axis 1 we use wsdd file. While in Axis2 we use services.xml or sun-jaxws.xml file.

You don't want .wsdd file in Axis2 , To understand the migration from Axis 1.x to Axis2 and the improvements in Axis2 in comparison with Axis1 visit Apache Axis article : https://axis.apache.org/axis2/java/core/docs/migration.html

Related

WSO2 ESB Callout Mediator axis2Configuration

I have a question regarding the WSO2 ESB callout mediator using an individual Axis2 configuration file. I would like to have the individual Axis2 configuration to be deployed using a carbon application. Unfortunately the callout mediator doesn't seem to be able to read the Axis2 configuration from the registry. I'm getting an error that the file axis2_blocking_client_proxy.xml can't be resolved when I deploy the carbon application that contains the mediation with my callout mediator.
The deployment works when I Quote a relative file path that points to the configuration file. Does anybody know if there is a way to tweak carbon application files so that distinct resources will be written to a dedicated directory on the WSO2 ESB Server?
Best regards,
Heiko
AFAIU, your requirement is to deploy an axis2 configuration file using a CAR (carbon application) file. This is not a recommended approach. If you need to deploy a configuration file in to the ESB, you can deploy that during the server creation time. CAR files are used to deploy the actual implementation code rather than the static configuration files.

JSON response from Axis2 Web Service

I am developing web service using Axis2, creating .aar file and deploying it in WSO2 Application Server. The Axis2 services deployed successfully and returns me the response as below.
<ns:serviceResponse xmlns:ns="http://service.axis.example.com">
<ns:return>{"status":"SUCCESS"}</ns:return>
</ns:serviceResponse>
But I am expecting a JSON response. Since Axis2 has support for JSON response, I tried following the below tutorial by modifying axis2.xml(Enabling messageBuilder and messageFormatter) but it was not successful.
http://axis.apache.org/axis2/java/core/docs/json_support.html
http://www.javacodegeeks.com/2012/02/json-web-service-with-java-and-axis2.html
Also,
I tried deploying wso2dynamic-response-20080916.170559-241.mar from UI (Modules Tab -> Add) and the uploaded file deployed to the following location(CARBON_HOME/repository/deployment/server/axis2modules).
And I tried copying wso2dynamic-response-1.5.jar as per suggestion in I can't to return json objects using Axis2 but still getting XML response instead of JSON.
Kindly let me know what I am doing wrong and guide to the right direction.
Thanks in Advance.
Would
JSONMessageFormatter.getJSONWriter
Help?
Enabling JSON message formatter in the axis2.xml should work..Anyway , what is your response's content type?..It should be application/json

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.

Axis2 : Generting Wsdl from java code

I have written a simple java class as shown below :
public class Simple {
public String echo(String rest) {
return rest;
}
}
I have written a Simple Services.xml file and deployed it inside the META-INF Folder and generated the .aar file for this and deployed it inside the Axis2 war file , and i got a wsdl from this
for example say
http://localhost:8080/axis2/services/SimpleService?wsdl
Now my question is , i have seen some examples where , java2wsdl.bat is uesd with the combination of Java File ( wsdl2java -cn javaclass file) , which then generates the wsdl file from this java class .
Please tell me what is the correct approach to generate the wsdl file , so that i can write a client for it and deploy it as a war file ?
Please share your ideas . Thank you very much in advance .
you need to deploy it as a service if you need to create a web service. So that others can access as well. But you intention is only to generate the wsdl file java2wsdl tool is enough.

Axis2 webservice client weblogic webservice client jar confilct

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