You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Eranaga Samararathna <er...@gmail.com> on 2011/08/24 18:14:14 UTC

[Axis2] ArrayOfAnyType Issue with adb

Hi,

I have created a sample client using Axis 2 for a service which takes
Object[] array as a parameter.
In WSDL it looks like

<xsd:complexType name="ArrayOfAnyType">
       <xsd:sequence>
             <xsd:element maxOccurs="unbounded" minOccurs="0" name="anyType"
nillable="true" type="xsd:anyType"/>
       </xsd:sequence>
</xsd:complexType>

The axis client takes OMElement for the ArrayOfAnyType parameter.

I have tried to create an OMElement as follows.

            Invoke invoke = new Invoke();

            OMFactory oMFactory = OMAbstractFactory.getOMFactory();
            OMNamespace ns2 = oMFactory.createOMNamespace("http://test.com/",
"ns2");
            OMNamespace xs = oMFactory.createOMNamespace("
http://www.w3.org/2001/XMLSchema", "xs");
            OMNamespace xsi = oMFactory.createOMNamespace("
http://www.w3.org/2001/XMLSchema-instance", "xsi");
            OMAttribute type = oMFactory.createOMAttribute("type", xsi,
"xs:string");

            OMElement parameterss = oMFactory.createOMElement("parameters",
ns2);

            OMElement anyType1 = oMFactory.createOMElement("anyType", xs,
parameterss);
            anyType1.addAttribute(type);
            anyType1.setText("dummyEvent");

            OMElement anyType2 = oMFactory.createOMElement("anyType", xs,
parameterss);
            anyType2.addAttribute(type);
            anyType2.setText("Dummy Event");

            invoke.setParameters(parameterss);

This generate a SOAP request following part.

<ns2:parameters><ns2:parameters xmlns:ns2="
http://system.api.pse.valista.com/"><xs:anyType xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:type="xs:string">dummyEvent</xs:anyType><xs:anyType xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">Dummy
Event</xs:anyType></ns2:parameters></ns2:parameters>

In here clearly can see <ns2:parameters> has repeated. I want to eliminate
this duplicate and get a SOAP request like

<ns2:parameters><xs:anyType xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="xs:string">dummyEvent</xs:anyType><xs:anyType xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">Dummy
Event</xs:anyType></ns2:parameters>

I do not find a way to do this. I need to have both anyType1 and anyType2
inside the <ns2:parameters> . I guess when calling
invoke.setParameters(parameterss); It put whole bunch inside another
<ns2:parameters>.

Appreciate any help to solve the issue.

Thanks

Regards,

Era

Re: [Axis2] ArrayOfAnyType Issue with adb

Posted by Eranaga Samararathna <er...@gmail.com>.
No difference. I am getting a following warning too.

[WARN] Type {http://www.w3.org/2001/XMLSchema}ArrayOfAnyType missing!

Command executed

> ./wsdl2java.sh -o test2 -uri http://localhost:8080/api/sysmgt?wsdl

CXF and JAX-WS solve Object[] nicely. But I do not know what's wrong with
axis2.

Thanks

Era

On Thu, Aug 25, 2011 at 11:45 AM, Sagara Gunathunga <
sagara.gunathunga@gmail.com> wrote:

>  Recently we have introduced number of improvements in same area that
> will ship with 1.7.0 release but still you can use them with SNAPSHOT
> versions . Can you try to run it again using SNAPSHOT version
> available here [1].
>
> [1] -
> https://builds.apache.org/view/A-F/view/Axis2/job/Axis2/org.apache.axis2$distribution/
>
> Thanks !
>
> On Thu, Aug 25, 2011 at 12:44 AM, Eranaga Samararathna
> <er...@gmail.com> wrote:
> > Dear Sagara,
> > I have tried both 1.5.5  and 1.4. I do not think it's possible to drop
> here
> > complete server side code. It has so many files.
> > In simple my issue comes with a service method signature
> > public void invoke(Object[] parameters);
> > This "Object[] parameters'' mapping to an OMElement in Axis client stub.
> > How could I use OMElement to send more than one parameter ?
> > Thanks
> > Regards,
> > Era
> >
> > On Wed, Aug 24, 2011 at 10:09 PM, Sagara Gunathunga
> > <sa...@gmail.com> wrote:
> >>
> >> Can you mention your Axis2 version ? also post complete server side
> code.
> >>
> >> Thanks !
> >>
> >> On Wed, Aug 24, 2011 at 9:44 PM, Eranaga Samararathna <
> erangac@gmail.com>
> >> wrote:
> >> > Hi,
> >> >
> >> > I have created a sample client using Axis 2 for a service which takes
> >> > Object[] array as a parameter.
> >> > In WSDL it looks like
> >> >
> >> > <xsd:complexType name="ArrayOfAnyType">
> >> >        <xsd:sequence>
> >> >              <xsd:element maxOccurs="unbounded" minOccurs="0"
> >> > name="anyType"
> >> > nillable="true" type="xsd:anyType"/>
> >> >        </xsd:sequence>
> >> > </xsd:complexType>
> >> >
> >> > The axis client takes OMElement for the ArrayOfAnyType parameter.
> >> >
> >> > I have tried to create an OMElement as follows.
> >> >
> >> >             Invoke invoke = new Invoke();
> >> >
> >> >             OMFactory oMFactory = OMAbstractFactory.getOMFactory();
> >> >             OMNamespace ns2 =
> >> > oMFactory.createOMNamespace("http://test.com/", "ns2");
> >> >             OMNamespace xs =
> >> > oMFactory.createOMNamespace("http://www.w3.org/2001/XMLSchema",
> "xs");
> >> >             OMNamespace xsi =
> >> > oMFactory.createOMNamespace("
> http://www.w3.org/2001/XMLSchema-instance",
> >> > "xsi");
> >> >             OMAttribute type = oMFactory.createOMAttribute("type",
> xsi,
> >> > "xs:string");
> >> >
> >> >             OMElement parameterss =
> >> > oMFactory.createOMElement("parameters",
> >> > ns2);
> >> >
> >> >             OMElement anyType1 = oMFactory.createOMElement("anyType",
> >> > xs,
> >> > parameterss);
> >> >             anyType1.addAttribute(type);
> >> >             anyType1.setText("dummyEvent");
> >> >
> >> >             OMElement anyType2 = oMFactory.createOMElement("anyType",
> >> > xs,
> >> > parameterss);
> >> >             anyType2.addAttribute(type);
> >> >             anyType2.setText("Dummy Event");
> >> >
> >> >             invoke.setParameters(parameterss);
> >> >
> >> > This generate a SOAP request following part.
> >> >
> >> > <ns2:parameters><ns2:parameters
> >> > xmlns:ns2="http://system.api.pse.valista.com/"><xs:anyType
> >> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> >> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> > xsi:type="xs:string">dummyEvent</xs:anyType><xs:anyType
> >> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> >> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> > xsi:type="xs:string">Dummy
> >> > Event</xs:anyType></ns2:parameters></ns2:parameters>
> >> >
> >> > In here clearly can see <ns2:parameters> has repeated. I want to
> >> > eliminate
> >> > this duplicate and get a SOAP request like
> >> >
> >> > <ns2:parameters><xs:anyType xmlns:xs="
> http://www.w3.org/2001/XMLSchema"
> >> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> > xsi:type="xs:string">dummyEvent</xs:anyType><xs:anyType
> >> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> >> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> > xsi:type="xs:string">Dummy Event</xs:anyType></ns2:parameters>
> >> >
> >> > I do not find a way to do this. I need to have both anyType1 and
> >> > anyType2
> >> > inside the <ns2:parameters> . I guess when calling
> >> > invoke.setParameters(parameterss); It put whole bunch inside another
> >> > <ns2:parameters>.
> >> >
> >> > Appreciate any help to solve the issue.
> >> >
> >> > Thanks
> >> >
> >> > Regards,
> >> >
> >> > Era
> >> >
> >> >
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Sagara Gunathunga
> >>
> >> Blog      - http://ssagara.blogspot.com
> >> Web      - http://people.apache.org/~sagara/
> >> LinkedIn - http://www.linkedin.com/in/ssagara
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> >> For additional commands, e-mail: java-user-help@axis.apache.org
> >>
> >
> >
>
>
>
> --
> Sagara Gunathunga
>
> Blog      - http://ssagara.blogspot.com
> Web      - http://people.apache.org/~sagara/
> LinkedIn - http://www.linkedin.com/in/ssagara
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>

Re: [Axis2] ArrayOfAnyType Issue with adb

Posted by Sagara Gunathunga <sa...@gmail.com>.
 Recently we have introduced number of improvements in same area that
will ship with 1.7.0 release but still you can use them with SNAPSHOT
versions . Can you try to run it again using SNAPSHOT version
available here [1].

[1] - https://builds.apache.org/view/A-F/view/Axis2/job/Axis2/org.apache.axis2$distribution/

Thanks !

On Thu, Aug 25, 2011 at 12:44 AM, Eranaga Samararathna
<er...@gmail.com> wrote:
> Dear Sagara,
> I have tried both 1.5.5  and 1.4. I do not think it's possible to drop here
> complete server side code. It has so many files.
> In simple my issue comes with a service method signature
> public void invoke(Object[] parameters);
> This "Object[] parameters'' mapping to an OMElement in Axis client stub.
> How could I use OMElement to send more than one parameter ?
> Thanks
> Regards,
> Era
>
> On Wed, Aug 24, 2011 at 10:09 PM, Sagara Gunathunga
> <sa...@gmail.com> wrote:
>>
>> Can you mention your Axis2 version ? also post complete server side code.
>>
>> Thanks !
>>
>> On Wed, Aug 24, 2011 at 9:44 PM, Eranaga Samararathna <er...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > I have created a sample client using Axis 2 for a service which takes
>> > Object[] array as a parameter.
>> > In WSDL it looks like
>> >
>> > <xsd:complexType name="ArrayOfAnyType">
>> >        <xsd:sequence>
>> >              <xsd:element maxOccurs="unbounded" minOccurs="0"
>> > name="anyType"
>> > nillable="true" type="xsd:anyType"/>
>> >        </xsd:sequence>
>> > </xsd:complexType>
>> >
>> > The axis client takes OMElement for the ArrayOfAnyType parameter.
>> >
>> > I have tried to create an OMElement as follows.
>> >
>> >             Invoke invoke = new Invoke();
>> >
>> >             OMFactory oMFactory = OMAbstractFactory.getOMFactory();
>> >             OMNamespace ns2 =
>> > oMFactory.createOMNamespace("http://test.com/", "ns2");
>> >             OMNamespace xs =
>> > oMFactory.createOMNamespace("http://www.w3.org/2001/XMLSchema", "xs");
>> >             OMNamespace xsi =
>> > oMFactory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance",
>> > "xsi");
>> >             OMAttribute type = oMFactory.createOMAttribute("type", xsi,
>> > "xs:string");
>> >
>> >             OMElement parameterss =
>> > oMFactory.createOMElement("parameters",
>> > ns2);
>> >
>> >             OMElement anyType1 = oMFactory.createOMElement("anyType",
>> > xs,
>> > parameterss);
>> >             anyType1.addAttribute(type);
>> >             anyType1.setText("dummyEvent");
>> >
>> >             OMElement anyType2 = oMFactory.createOMElement("anyType",
>> > xs,
>> > parameterss);
>> >             anyType2.addAttribute(type);
>> >             anyType2.setText("Dummy Event");
>> >
>> >             invoke.setParameters(parameterss);
>> >
>> > This generate a SOAP request following part.
>> >
>> > <ns2:parameters><ns2:parameters
>> > xmlns:ns2="http://system.api.pse.valista.com/"><xs:anyType
>> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > xsi:type="xs:string">dummyEvent</xs:anyType><xs:anyType
>> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > xsi:type="xs:string">Dummy
>> > Event</xs:anyType></ns2:parameters></ns2:parameters>
>> >
>> > In here clearly can see <ns2:parameters> has repeated. I want to
>> > eliminate
>> > this duplicate and get a SOAP request like
>> >
>> > <ns2:parameters><xs:anyType xmlns:xs="http://www.w3.org/2001/XMLSchema"
>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > xsi:type="xs:string">dummyEvent</xs:anyType><xs:anyType
>> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > xsi:type="xs:string">Dummy Event</xs:anyType></ns2:parameters>
>> >
>> > I do not find a way to do this. I need to have both anyType1 and
>> > anyType2
>> > inside the <ns2:parameters> . I guess when calling
>> > invoke.setParameters(parameterss); It put whole bunch inside another
>> > <ns2:parameters>.
>> >
>> > Appreciate any help to solve the issue.
>> >
>> > Thanks
>> >
>> > Regards,
>> >
>> > Era
>> >
>> >
>> >
>> >
>>
>>
>>
>> --
>> Sagara Gunathunga
>>
>> Blog      - http://ssagara.blogspot.com
>> Web      - http://people.apache.org/~sagara/
>> LinkedIn - http://www.linkedin.com/in/ssagara
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-user-help@axis.apache.org
>>
>
>



-- 
Sagara Gunathunga

Blog      - http://ssagara.blogspot.com
Web      - http://people.apache.org/~sagara/
LinkedIn - http://www.linkedin.com/in/ssagara

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: [Axis2] ArrayOfAnyType Issue with adb

Posted by Eranaga Samararathna <er...@gmail.com>.
Dear Sagara,

I have tried both 1.5.5  and 1.4. I do not think it's possible to drop here
complete server side code. It has so many files.
In simple my issue comes with a service method signature

public void invoke(Object[] parameters);

This "Object[] parameters'' mapping to an OMElement in Axis client stub.
How could I use OMElement to send more than one parameter ?

Thanks

Regards,

Era


On Wed, Aug 24, 2011 at 10:09 PM, Sagara Gunathunga <
sagara.gunathunga@gmail.com> wrote:

> Can you mention your Axis2 version ? also post complete server side code.
>
> Thanks !
>
> On Wed, Aug 24, 2011 at 9:44 PM, Eranaga Samararathna <er...@gmail.com>
> wrote:
> > Hi,
> >
> > I have created a sample client using Axis 2 for a service which takes
> > Object[] array as a parameter.
> > In WSDL it looks like
> >
> > <xsd:complexType name="ArrayOfAnyType">
> >        <xsd:sequence>
> >              <xsd:element maxOccurs="unbounded" minOccurs="0"
> name="anyType"
> > nillable="true" type="xsd:anyType"/>
> >        </xsd:sequence>
> > </xsd:complexType>
> >
> > The axis client takes OMElement for the ArrayOfAnyType parameter.
> >
> > I have tried to create an OMElement as follows.
> >
> >             Invoke invoke = new Invoke();
> >
> >             OMFactory oMFactory = OMAbstractFactory.getOMFactory();
> >             OMNamespace ns2 =
> > oMFactory.createOMNamespace("http://test.com/", "ns2");
> >             OMNamespace xs =
> > oMFactory.createOMNamespace("http://www.w3.org/2001/XMLSchema", "xs");
> >             OMNamespace xsi =
> > oMFactory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance",
> > "xsi");
> >             OMAttribute type = oMFactory.createOMAttribute("type", xsi,
> > "xs:string");
> >
> >             OMElement parameterss =
> oMFactory.createOMElement("parameters",
> > ns2);
> >
> >             OMElement anyType1 = oMFactory.createOMElement("anyType", xs,
> > parameterss);
> >             anyType1.addAttribute(type);
> >             anyType1.setText("dummyEvent");
> >
> >             OMElement anyType2 = oMFactory.createOMElement("anyType", xs,
> > parameterss);
> >             anyType2.addAttribute(type);
> >             anyType2.setText("Dummy Event");
> >
> >             invoke.setParameters(parameterss);
> >
> > This generate a SOAP request following part.
> >
> > <ns2:parameters><ns2:parameters
> > xmlns:ns2="http://system.api.pse.valista.com/"><xs:anyType
> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:type="xs:string">dummyEvent</xs:anyType><xs:anyType
> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:type="xs:string">Dummy
> > Event</xs:anyType></ns2:parameters></ns2:parameters>
> >
> > In here clearly can see <ns2:parameters> has repeated. I want to
> eliminate
> > this duplicate and get a SOAP request like
> >
> > <ns2:parameters><xs:anyType xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:type="xs:string">dummyEvent</xs:anyType><xs:anyType
> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:type="xs:string">Dummy Event</xs:anyType></ns2:parameters>
> >
> > I do not find a way to do this. I need to have both anyType1 and anyType2
> > inside the <ns2:parameters> . I guess when calling
> > invoke.setParameters(parameterss); It put whole bunch inside another
> > <ns2:parameters>.
> >
> > Appreciate any help to solve the issue.
> >
> > Thanks
> >
> > Regards,
> >
> > Era
> >
> >
> >
> >
>
>
>
> --
> Sagara Gunathunga
>
> Blog      - http://ssagara.blogspot.com
> Web      - http://people.apache.org/~sagara/
> LinkedIn - http://www.linkedin.com/in/ssagara
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>

Re: [Axis2] ArrayOfAnyType Issue with adb

Posted by Sagara Gunathunga <sa...@gmail.com>.
Can you mention your Axis2 version ? also post complete server side code.

Thanks !

On Wed, Aug 24, 2011 at 9:44 PM, Eranaga Samararathna <er...@gmail.com> wrote:
> Hi,
>
> I have created a sample client using Axis 2 for a service which takes
> Object[] array as a parameter.
> In WSDL it looks like
>
> <xsd:complexType name="ArrayOfAnyType">
>        <xsd:sequence>
>              <xsd:element maxOccurs="unbounded" minOccurs="0" name="anyType"
> nillable="true" type="xsd:anyType"/>
>        </xsd:sequence>
> </xsd:complexType>
>
> The axis client takes OMElement for the ArrayOfAnyType parameter.
>
> I have tried to create an OMElement as follows.
>
>             Invoke invoke = new Invoke();
>
>             OMFactory oMFactory = OMAbstractFactory.getOMFactory();
>             OMNamespace ns2 =
> oMFactory.createOMNamespace("http://test.com/", "ns2");
>             OMNamespace xs =
> oMFactory.createOMNamespace("http://www.w3.org/2001/XMLSchema", "xs");
>             OMNamespace xsi =
> oMFactory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance",
> "xsi");
>             OMAttribute type = oMFactory.createOMAttribute("type", xsi,
> "xs:string");
>
>             OMElement parameterss = oMFactory.createOMElement("parameters",
> ns2);
>
>             OMElement anyType1 = oMFactory.createOMElement("anyType", xs,
> parameterss);
>             anyType1.addAttribute(type);
>             anyType1.setText("dummyEvent");
>
>             OMElement anyType2 = oMFactory.createOMElement("anyType", xs,
> parameterss);
>             anyType2.addAttribute(type);
>             anyType2.setText("Dummy Event");
>
>             invoke.setParameters(parameterss);
>
> This generate a SOAP request following part.
>
> <ns2:parameters><ns2:parameters
> xmlns:ns2="http://system.api.pse.valista.com/"><xs:anyType
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="xs:string">dummyEvent</xs:anyType><xs:anyType
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="xs:string">Dummy
> Event</xs:anyType></ns2:parameters></ns2:parameters>
>
> In here clearly can see <ns2:parameters> has repeated. I want to eliminate
> this duplicate and get a SOAP request like
>
> <ns2:parameters><xs:anyType xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="xs:string">dummyEvent</xs:anyType><xs:anyType
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="xs:string">Dummy Event</xs:anyType></ns2:parameters>
>
> I do not find a way to do this. I need to have both anyType1 and anyType2
> inside the <ns2:parameters> . I guess when calling
> invoke.setParameters(parameterss); It put whole bunch inside another
> <ns2:parameters>.
>
> Appreciate any help to solve the issue.
>
> Thanks
>
> Regards,
>
> Era
>
>
>
>



-- 
Sagara Gunathunga

Blog      - http://ssagara.blogspot.com
Web      - http://people.apache.org/~sagara/
LinkedIn - http://www.linkedin.com/in/ssagara

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org