Can you mention your Axis2 version ? also post complete server side code.

Thanks !

On Wed, Aug 24, 2011 at 9:44 PM, Eranaga Samararathna <eran...@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-unsubscr...@axis.apache.org
For additional commands, e-mail: java-user-h...@axis.apache.org

Reply via email to