users@jax-rpc.java.net

Re: Return an array of objects

From: Mariano Garcia <mgarcia_at_entel.es>
Date: Thu, 08 Sep 2005 13:35:14 +0200

oh yes, solved!!! :D

FYI, and for all that can have the same problem:

* I have used this features in wscompile tool: rpcliteral,wsi.
* I have mapped my types as following:

<xsd:complexType name="ArrayOfAlarm">
<xsd:sequence>
        <xsd:element name="alarm" type="impl:Alarm" minOccurs="0"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>

<complexType name="Alarm">
<sequence>
        <element name="id" type="xsd:int"/>
        <element name="str" type="xsd:string"/>
</sequence>
</complexType>

   
<complexType name="getAlarmsResponse">
    <complexContent>
     <sequence>
      <element name="alarmList" type="impl:ArrayOfAlarm"/>
     </sequence>
    </complexContent>
</complexType>

Now, Alarm and getAlarmsResponse classes are generated ^_^

Please, refer to
http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html#WSDLTYPES
in order to know how to declare custom types and arrays in WSDL format.

Thanks!!!

On Thu, 2005-09-08 at 13:02 +0200, Mariano Garcia wrote:
> Well,
>
> Some problems were founded and solved, but I have some problems yet :S.
> I think the problem is the generation of the wrapper classes from my
> messages.
>
> I'm using a rpc/literal model, so each message part should be mapped to
> a Java type, but it is not. These are the classes I get when I use
> wscompile:
>
> * SCIBWebServiceService (service)
> * SCIBWebService (service interface)
> * SCIBWebService_Impl (service interface impl)
> * SCIBWebService_getAlarms_ResponseStruct (wrapper class generated for
> getAlarms response)
> * SCIBWebService_getAlarms_RequestStruct (wrapper class generated for
> getAlarms request)
>
> The problem is the interface generated returns a SOAPElement object, and
> it should return a SCIBWebService_getAlarms_ResponseStruct class. Do you
> know why?
>
> I have read this in an ibm article:
>
> "In the case of literal mapping, each message part is mapped to a Java
> type, [...]. If no such mapping exists, the message part is represented
> using a javax.xml.soap.SOAPElement Java class. An example for this
> mapping is a complex type containing attributes. Since no standard
> mapping is defined for attributes, this complex type is represented as a
> SOAPElement."
>
> But all the complext types are mapped. Am I forgetting something?
>
> My types:
>
> <complexType name="ArrayOfAlarm">
> <complexContent>
> <restriction base="soap-enc:Array">
> <attribute ref="soap-enc:arrayType" wsdl:arrayType="impl:Alarm[]"/>
> </restriction>
> </complexContent>
> </complexType>
>
> <complexType name="Alarm">
> <sequence>
> <element name="id" type="xsd:int"/>
> <element name="str" type="xsd:string"/>
> </sequence>
> </complexType>
>
> <complexType name="getAlarmsResponse">
> <complexContent>
> <sequence>
> <element name="alarmList" type="impl:ArrayOfAlarm"/>
> </sequence>
> </complexContent>
> </complexType>
>
>
>
> Mariano García González :: Analista Programador
> -----------------------------------------------
>
> Entel IT Consulting, SA
> Tlf. 91 567 07 36
> Mobile. 619 08 70 90
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
-- 
Mariano García González :: Analista Programador
-----------------------------------------------
Entel IT Consulting, SA
Tlf.    91 567 07 36
Mobile. 619 08 70 90