Jaxws ri claims to support MTOM but I have not used it. A web search
revealed that it's been in for about 18 months, so maybe it's baked (depends
on how much use it's gotten). Re: String[], I bit the bullet and performed
the refactor on our code, but we didn't have nearly as many methods
returning arrays (of any type) as you.
I did notice one interesting thing in my refactor, because we use the new
Java5 'for' looping construct often in our code meant very little of the
code had to change, i.e.:
String[] foos = service.doSomething();
for (String foo : foos)
{
...
}
Refactored seamlessly to:
List<String> foos = service.doSomething();
for (String foo : foos)
{
...
}
Everything "just worked". There was a very few places where we did
something like foos[0] that we had to change to foos.get(0).
-Brett
On 8/10/07 12:42 AM, "doug" <[EMAIL PROTECTED]> wrote:
> Hi James,
>
> On Friday 10 August 2007 13:03, James Mao wrote:
>> Well, i tried yesterday, i have the same results as you gave, the
>> previous binding file is not correct, you can not put the wsdl location
>> inside the schemaLocation.
>
> Oh. That bit actually seemed to work, in the sense that changing the
> node to something like node="/xsd:schema/annotation/appinfo"
> throws exceptions owing to an empty nodeset or some such, but throws no such
> errors if I actually added the annotation and appinfo elements to the schema.
> Of course it didn't influence the generated WS interface at all.
>
>> The interface really did not change, what changed is the type class, you
>> can see there is String[], but it use the List indeed
>> I also tried the jaxws ri, what i got is the same results.
>>
>> I guess you must use String[] here, so hope someone else can shed some
>> lights here.
>
> Well, I have about 5 services, each with around 10 or so String[] return
> methods. I would prefer not to change the client and server code to use
> Lists if I could avoid it, but will do what I have to do I guess.
> I heard good things about MTOM for file transfer so I want to stick to a
> solution where its accessible. Not sure that jaxws ri supports it.
>
>
> Am still looking for insight into the server side Exception throwing
> aspects, if anyone had any pointers?
>
> Thanks
> Doug
>
>>> 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