JAX-WS (2.1 EA3) sides with JBoss. It looks like an XFire bug.
To figure it what JAX-WS does, I simply modified their "fromjava"
sample. I added a couple methods to AddNumbersImpl.java that use
arrays.
cd $JAXWS_HOME/samples/fromjava/
ant help
server-j2se
http://localhost:8080/jaxws-fromjava/addnumbers?wsdl
http://localhost:8080/jaxws-fromjava/addnumbers?xsd=1
In the XSD, you get
<xs:element name="arg0" type="xs:string" minOccurs="0" maxOccurs="unbounded">
Cameron
On 1/16/07, Cameron Taggart <[EMAIL PROTECTED]> wrote:
How should a String array get encoded for JSR 181? According to the
documentation the default is document literal wrapped and that is what
I'm using.
https://jax-ws.dev.java.net/nonav/jax-ws-21-ea3/docs/annotations.html
When a String[] is passed in as a parameter, should it be encoded like this:
<fruit>
<string>apple</string>
<string>banana</string>
<string>orange</string>
</fruit>
or
<fruit>apple</fruit>
<fruit>banana</fruit>
<fruit>orange</fruit>
Hopefully, either JBoss or XFire is doing it incorrectly. If not,
then using JSR 181 annotations isn't portable between implementations,
which would suck. Any suggestions for how to figure this out. I'm
going to see what the JAX-WS reference implementation does.
Cameron
On 1/15/07, Cameron Taggart <[EMAIL PROTECTED]> wrote:
> I'm trying to switch for JBoss-WS to XFire and running into some
> differences into the produced wsdl files with regards to String
> arrays. Here is the JSR-181 annotation:
>
> @WebParam(name = "input") String[] input
>
> and for JBoss, it produces this is the wsdl:
>
> <element maxOccurs="unbounded" minOccurs="0" name="input"
> nillable="true" type="string"/>
>
> yet XFire produces this.
>
> <xsd:element maxOccurs="1" minOccurs="1" name="input" nillable="true"
> type="tns:ArrayOfString"/>
>
> <xsd:complexType name="ArrayOfString">
> <xsd:sequence>
> <xsd:element maxOccurs="unbounded" minOccurs="0" name="string"
> nillable="true" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
>
> The WSDL's are obviously different. JBoss expects:
> <input>apple</input>
> <input>orange</input>
> <input>banana</input>
>
> XFire expects:
> <input>
> <string>apple</string>
> <string>orange</string>
> <string>banana</string>
> </input>
>
> I was expecting them to be identical so I don't have to change the
> clients anytime I change the JSR181 library implementation. Any idea
> what is wrong or if one library is doing it wrong? I'm using wrapped
> document literal:
>
> @SOAPBinding (style = SOAPBinding.Style.DOCUMENT,
> use = SOAPBinding.Use.LITERAL,
> parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
>
> thanks,
> Cameron
>
package fromjava.server;
import javax.jws.WebService;
@WebService
public class AddNumbersImpl {
/**
* @param number1
* @param number2
* @return The sum
* @throws AddNumbersException
* if any of the numbers to be added is negative.
*/
public int addNumbers(int number1, int number2) throws AddNumbersException {
if (number1 < 0 || number2 < 0) {
throw new AddNumbersException("Negative number cant be added!",
"Numbers: " + number1 + ", " + number2);
}
return number1 + number2;
}
public int addNumbers2(int[] numbers){
int total = 0;
for(int number : numbers){
total += number;
}
return total;
}
public String concatenate(String[] strings){
StringBuilder sb = new StringBuilder();
for(String s : strings){
sb.append(s);
}
return sb.toString();
}
}
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email