If I explicitly modify the generated WSDL file as follows:
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:srv"
attributeFormDefault="unqualified"
elementFormDefault="unqualified"
targetNamespace="urn:srv"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
jxb:version="1.0" >
<xs:annotation>
<xs:appinfo>
<!-- <jxb:globalBindings collectionType="java.util.ArrayList"/> -->
<jxb:globalBindings collectionType="indexed"/>
</xs:appinfo>
</xs:annotation>
[snip]
<xs:complexType name="getApplicationPushletIDsResponse">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="return"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
[cut]
then wsdl2java runs without any exceptions and I still end up with
java.util.List responses:
@WebService(targetNamespace = "urn:srv", name = "PfC")
public interface PfC {
@ResponseWrapper(targetNamespace = "urn:srv", className
= "au.net.mmsn.pfc.servlet.pfcws.GetApplicationPushletIDsResponse", localName
= "getApplicationPushletIDsResponse")
@RequestWrapper(targetNamespace = "urn:srv", className
= "au.net.mmsn.pfc.servlet.pfcws.GetApplicationPushletIDs", localName
= "getApplicationPushletIDs")
@WebResult(targetNamespace = "", name = "return")
@WebMethod
public java.util.List<java.lang.String> getApplicationPushletIDs();
My original prototype interface was:
@WebService(name="PfC",
targetNamespace="urn:srv",
serviceName="PfCService",
portName="PfC")
@SOAPBinding(style=Style.DOCUMENT, use=Use.LITERAL,
parameterStyle = ParameterStyle.WRAPPED)
public interface PfC extends java.rmi.Remote {
// primary pushlet url
public java.lang.String getPushletURL() throws java.rmi.RemoteException;
public java.lang.String[] getApplicationPushletIDs() throws
java.rmi.RemoteException;
...
The commandline was:
wsdl2java -verbose -server -compile -classdir
/home/timeout/ddb/MMSN/gridsphere-2.2.7/projects/pfc/build/classes -impl -d
/home/timeout/ddb/MMSN/gridsphere-2.2.7/projects/pfc/src -p
au.net.mmsn.pfc.servlet.pfcws PfC.wsdl
wsdl2java - 2.0-incubator
Changing the collectionType attribute to an ArrayList has no effect iether.
Hope somone can see what I am doing wrong.
thanks
Doug
On Thursday 09 August 2007 17:00, doug wrote:
> Hi list,
> I apologise in advance for my ignorance but I am trying to
> convert my Axis 1 SOAP client/services to CXF, and as a complete
> newbie to CXF and JAXB, am having quite a few difficulties.
>
> My latest issue is the same as a recent correspondent (Brett) in that my
> web service interface methods that ought to return arrays are being
> converted into java.util.Lists.
>
> Also some of my original java prototype interface methods had
> throws RemoteException
> clauses which apparently do not propogate through the WSDL to the
> generated java source.
>
> On the first issue, James Mao replied to Brett:
> ---------------------------
> Yes, There are two ways
>
> Put the customization section into your schema in the wsdl,
>
> <xsd:annotation>
> <xsd:appinfo>
> <jxb:globalBindings collectionType="indexed"/>
> </xsd:appinfo>
> </xsd:annotation>
>
>
> or change it to an external style, and feed the 'binding file' to the
>
> > wsdl2java -b $YOUR_BINDNIG_FILE
>
> -----------------------------
>
> Trying to use the second method, I have a bindings.jxb file that
> looks like the following, where ./PfC.wsdl is m
> java2wsdl generated file:
>
> <jxb:bindings jxb:version="1.0"
> xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
> <jxb:bindings schemaLocation="./PfC.wsdl" node="/xsd:schema">
> <jxb:globalBindings collectionType="indexed">
> </jxb:globalBindings>
> </jxb:bindings>
> </jxb:bindings>
>
> Unfortunately it doesn't seem to work for me when I run
> wsdl2java -b bindings.jxb ...
> because, although it runs without throwing any exsceptions,
> the array return methods still return java.util.Lists
> As I mentioned, I am a complete novice to this, so would
> appreciate if someone could provide a more explicit answer
> (and also a pointer to how to solve the exception returning problem)
>
> Should I have explicitly annotated all the array return methods in my
> original java prototype interface somehow?
>
> Many thanks
> Doug
>
> P.S. running wsdl2java - 2.0-incubator