[jboss-user] [JBossWS] - Re: returning array undefined in web service

mckeno do-not-reply at jboss.com
Wed Nov 28 23:03:00 EST 2007


Hi Alessio,
Here are some more details:

The wsdl schema:
<definitions name="MyService"targetNamespace="http://xxx/yyy/services">
  | <types>
  | 	<xs:schema targetNamespace="http://xxx/yyy/services" version="1.0">
  | 		<xs:element name="getNumber" type="tns:getNumber"/>
  | 		<xs:element name="getNumberResponse" type="tns:getNumberResponse"/>
  | 		<xs:complexType name="getNumber">
  | 			<xs:sequence>
  | 				<xs:element minOccurs="0" name="userName" type="xs:string"/>
  | 			</xs:sequence>
  | 		</xs:complexType>
  | 
  | 		<xs:complexType name="getNumberResponse">
  | 			<xs:sequence>
  | 				<xs:element maxOccurs="unbounded" minOccurs="0" name="numbers" type="xs:int"/>
  | 			</xs:sequence>
  | 		</xs:complexType>
  | 	</xs:schema>
  | </types>
  | 
  | <message name="Mojo_getNumberResponse">
  | 	<part element="tns:getNumberResponse" name="getNumberResponse"/>
  | </message>
  | 
  | <message name="Mojo_getNumber">
  | 	<part element="tns:getNumber" name="getNumber"/>
  | </message>
  | 
  | <portType name="Mojo">
  | 	<operation name="getNumber" parameterOrder="getNumber">
  | 		<input message="tns:Mojo_getNumber"/>
  | 		<output message="tns:Mojo_getNumberResponse"/>
  | 	</operation>
  | </portType>
  | 
  | <binding name="MojoBinding" type="tns:Mojo">
  | 	<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
  | 	<operation name="getNumber">
  | 		<soap:operation soapAction=""/>
  | 		<input>
  | 			<soap:body use="literal"/>
  | 		</input>
  | 		<output>
  | 			<soap:body use="literal"/>
  | 		</output>
  | 	</operation>
  | </binding>
  | 
  | <service name="MojoService">
  | 	<port binding="tns:MojoBinding" name="MojoPort">
  | 		<soap:address location="http://localhost:8080/myService/MyWebService"/>
  | 	</port>
  | </service>
  | </definitions>

The web service class in EJB container


  | @Stateless
  | @WebService(name = "Mojo", targetNamespace = "http://xxx/yyy/services", serviceName = "MyService")
  | @WebContext(contextRoot="/myService")
  | @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
  | public class MyWebService {
  | 
  | 	@SuppressWarnings("unused")
  | 	private Logger log = Logger.getLogger(this.getClass());
  | 	
  | 	@WebMethod
  | 	@WebResult(name = "numbers")
  | 	public int[] getNumber(@WebParam(name = "userName") String sth) {
  | 		int[] number = new int[3];
  | 		number[0] = 7;
  | 		number[1] = 2;
  | 		number[2] = 3;
  | 		System.out.println("Get Number call");
  | 		log.info("ARRAY METHOD CALLED " + number.length);
  | 		return number;
  | 	}
  | }

JBoss version : [Server] Release ID: JBoss [Trinity] 4.2.0.GA (build: SVNTag=JBoss_4_2_0_GA date=200705111440)
JbossWS: I think i used the one came with the Jboss server, not sure how to check its version...
I did use soapUI to capture the request and respone and it works ok:

request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://xxx/yyy/services">
  |    <soapenv:Header/>
  |    <soapenv:Body>
  |       <ser:getNumber>
  |          <!--Optional:-->
  |          <userName>3</userName>
  |       </ser:getNumber>
  |    </soapenv:Body>
  | </soapenv:Envelope>

response:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  |    <env:Header/>
  |    <env:Body>
  |       <ns2:getNumberResponse xmlns:ns2="http://mojo.streamverse.com/services">
  |          <numbers>7</numbers>
  |          <numbers>2</numbers>
  |          <numbers>3</numbers>
  |       </ns2:getNumberResponse>
  |    </env:Body>
  | </env:Envelope>

Only that when it is called from the Flash application(flash 7, using WebService Connector) then the results always undefined(non array result works ok in flash).

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108757#4108757

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108757



More information about the jboss-user mailing list