Issue Details (XML | Word | Printable)

Key: JAX_WS-1026
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Martin Grebac
Reporter: gdavison
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
jax-ws

wgen no longer fails when generating wsdl if parameter is not seriazable as a XML element

Created: 18/Nov/11 01:53 PM   Updated: 30/Nov/11 05:46 PM
Component/s: wsgen
Affects Version/s: 2.2.6
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive OpaqueTypes.zip (32 kB) 18/Nov/11 01:53 PM - gdavison

Environment:

Linux, JDeveloper/Command line


Tags: jdeveloper metro2_2-waived
Participants: gdavison and Martin Grebac


 Description  « Hide

So we have a test class that looks as follows:

package service;

import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

import javax.xml.ws.Holder;

@WebService
public class ServiceImpl {
public ServiceImpl() { super(); }

@WebMethod
public String echoString(@WebParam(name = "arg0")
String echo) { return echo; }

@WebMethod
public int add(@WebParam(name = "arg0")
int x, @WebParam(name = "arg1")
int y) { return x + y; }

@WebMethod
public Integer sub(@WebParam(name = "arg0")
Integer x, @WebParam(name = "arg1")
Integer y) { return new Integer(x.intValue() + y.intValue()); }

@WebMethod
public Person echoPerson(@WebParam(name = "arg0")
Person echo) { return echo; } }

@WebMethod
public Opaque echoOpaque(@WebParam(name = "arg0")
Opaque echo) { return echo; }

@WebMethod
@Oneway
public void setUnserializable(@WebParam(name = "arg0")
Unserializable echo) {
}

@WebMethod
public void mul(@WebParam(name = "arg0", mode = WebParam.Mode.INOUT)
Holder<Integer> x, @WebParam(name = "arg1")
int y) { x.value = x.value.intValue() * y; }

}

In particular the Opaque class looks like this:

package service;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

public class Opaque {

private int[] _internalData;

public Opaque(int[] internalData) { _internalData = internalData; }

/package/ Iterator internalData() { List l = Arrays.asList(_internalData); return l.iterator(); }
}

When generated with older versions of JAX-WS wsgen you would see a failure on this class are it doesn't present the required no-arg constructor making it impossible to desrialize it on the sever without intevention.

[gdavison@gbr10153 src]$ /ade/gdavison_lt/oracle/jdk/bin/wsgen -Xendorsed -cp ../classes service.ServiceImpl -wsdl
Exception in thread "main" javax.xml.ws.WebServiceException: Unable to create JAXBContext
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:153)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:83)
at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:244)
at com.sun.tools.internal.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:229)
at com.sun.tools.internal.ws.wscompile.WsgenTool.run(WsgenTool.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:105)
at com.sun.tools.internal.ws.WsGen.main(WsGen.java:41)
Caused by: java.security.PrivilegedActionException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
service.Opaque does not have a no-arg default constructor.
this problem is related to the following location:
at service.Opaque
at private service.Opaque service.jaxws.EchoOpaque.arg0
at service.jaxws.EchoOpaque
service.Unserializable does not have a no-arg default constructor.
this problem is related to the following location:
at service.Unserializable
at private service.Unserializable service.jaxws.SetUnserializable.arg0
at service.jaxws.SetUnserializable

at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:140)
... 10 more
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
service.Opaque does not have a no-arg default constructor.
this problem is related to the following location:
at service.Opaque
at private service.Opaque service.jaxws.EchoOpaque.arg0
at service.jaxws.EchoOpaque
service.Unserializable does not have a no-arg default constructor.
this problem is related to the following location:
at service.Unserializable
at private service.Unserializable service.jaxws.SetUnserializable.arg0
at service.jaxws.SetUnserializable

at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:436)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:277)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1100)
at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:143)
at com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:95)
at com.sun.xml.internal.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:97)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:148)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:140)
... 12 more

Now when I try the same action with a recent build of JAX-WS 2.2.6 branch I find that the WSDL generates without errors which appears to be incorrect and represents a regression as we use this failure to display to the user which methods are invalid.



gdavison added a comment - 18/Nov/11 01:56 PM

Attached project is in JDeveloper format; but you can run the wsgen commands on the Project1/src and clasess directories.