Pergunta

In my wsdl file I have following part

<s:element maxOccurs="1" minOccurs="0" name="Request">
<s:complexType>
<s:sequence>
<s:any/>
</s:sequence>
</s:complexType>
</s:element>

So, I generated axis2 stub to this wsdl and it created to element Request this class

Request_type0 rqType0 = new Request_type0();

which has only method rqType0.setExtraElement(OMElement);

I need to send request like this,

     <web:Request>
        <test1>
           <t>1</t>
        </test1>
        <test2>
           <t>2</t>
        </test2>
     </web:Request>

please help me!!!

Foi útil?

Solução

According to my understanding of XML Schema, your wsdl snippet states that below the Request element, there can be only one element of any type. For more elements of any type, there should be maxOccurs="unbounded" present on the any element declaration.
See also this link for further explanation: http://www.w3schools.com/schema/el_any.asp

For creating OMElements, you can use code like this:

OMFactory fac = OMAbstractFactory.getOMFactory();
OMElement test1 = fac.createOMElement("test1", "", "");
OMElement t1 = fac.createOMElement("t", "", "");

t1.setText("1");
test1.addChild(t1);

Hope this helps. :)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top