I am trying to integrate with some legacy application in which they already have defined their message format as well as data structure.
Now we use Java 6 to publish our web service via following code:
Endpoint.publish(urlString, new NotificationListener());
My NotificationListener service contains 1 method and its definition is something as follows:
@WebService
public class NotificationListener {
@WebMethod(action="notifyStatus111")
@WebResult(name="NotificationResponse")
public NotificationResponse notifyStatus1(@WebParam(name="Notification") Notification Notification)
{
return new NotificationResponse();
}
and using wsgen command to generate stubs for the webservice via following ant command:
<project default="wsgen">
<target name="wsgen" >
<exec executable="wsgen">
<arg line="-cp ./bin -keep -s ./src -d ./bin com.xyz.listener.NotificationListener"/>
</exec>
</target>
</project>
Now problem is that the generated stubs as well as wsdl creates wrapper with method name over input and output objects.
For example, definition of generated id is as follows:
@XmlRootElement(name = "notifyStatus1")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "notifyStatus1")
public class NotifyStatus1 {
@XmlElement(name = "notification", namespace = "")
private com.xyz.listener.notifications.Notification notification;
}
In which notification object is embedded inside the NotifyStatus1 stub.
However legacy application doesn't expect same, instead it expects Notification object to be direct root element.
So is their any way by which I can define Notifcation as root instead of wrapping inside same as wrapper and publish my definition accordingly.
Any points help are highly appreciated.