See this code sample
GetListResponse getListResponse = new GetListResponse();
GetListResult_type0 getListResult_type0 = new GetListResult_type0();
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMNamespace omNamespace = omFactory.createOMNamespace("
http://test.com","ns1");
OMElement omElement = omFactory.createOMElement("test",omNamespace);
omElement.setText("text");
getListResult_type0.setExtraElement(omElement);
getListResponse.setGetListResult(getListResult_type0);
OMElement responseElement = getListResponse.getOMElement(
GetListResponse.MY_QNAME,OMAbstractFactory.getSOAP11Factory());
try {
String responseString = responseElement.toStringWithConsume();
System.out.println("Response " + responseString);
} catch (XMLStreamException e) {
e.printStackTrace(); //To change body of catch statement use
File | Settings | File Templates.
}
On 5/3/07, Amila Suriarachchi <[EMAIL PROTECTED]> wrote:
hi this is your schema
<s:element name="GetListItemsResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="GetListItemsResult">
<s:complexType mixed="true">
<s:sequence>
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
the element GetListItemsResult has a complex type which contains an s:any
element
So ADB generates a seperate class for this type with an OMElement ( i.ethe
localExtraElement) So any xml element you want to send within the
GetListItemsResult Element can be set using getter and setter methods of
this class.
You can simply instanciate any ADB class using the new operator.
GetListItemsResponse getListItemsResponse = new GetListItemsResponse();
GetListItemsResult_type result = new GetListItemsResult_type():
result.setLocalExtraElement(set the OMElement);
and set variables with getter and setter methods.
eg.
On 5/2/07, no spam <[EMAIL PROTECTED]> wrote:
>
> Thanks, Anne, and also Martin. Here is the complete WSDL file. It's
> GetListItems and GetListItemChanges that I'm concerned with.
>
> I think this stuff is unnecessarily a brain-twister. Generating a new
> type which has almost nothing in it except "implements ADBBean" and some
> "extraElement" stuff which is never explained (and what IS that for,
> anyway? what's an "extra element"?) is not at all helpful to the
> implementor. If all I want to do is provide some XML which is completely
> unconstrained (sequence of any), there ought to be a very intuitive way to
> do it.
>
> Bob
>
> ----- Original Message ----
> From: Anne Thomas Manes <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Tuesday, May 1, 2007 2:27:18 AM
> Subject: Re: newbie help - how to build up an ADBBean?
>
> Bob,
>
> Your challenge is that the element contains an <xsd:any>. That's a
> wildcard. ADB has no way of knowing what it might contain, therefore
> it gives you an OMElement. It can't map it to a more defined object
> because it doesn't know what kind of object it is. You must process it
> as an OMElement.
>
> How does the viewFields type relate to the request/response messages?
> Can you provide more of the schema?
>
> Anne
>
> On 4/30/07, no spam < [EMAIL PROTECTED]> wrote:
> >
> > thank you and I did read that, but it gives me no idea at all how to
> get the
> > ADBBean from the OMElement (or whatever). ADB javadocs, which I've
> also
> > looked at, seem completely disconnected from everything else.
> >
> > Bob
> >
> > ----- Original Message ----
> > From: Davanum Srinivas <[EMAIL PROTECTED]>
> > To: [email protected]
> > Sent: Monday, April 30, 2007 1:26:28 PM
> > Subject: Re: newbie help - how to build up an ADBBean?
> >
> > see the OM tutorial -
> > http://ws.apache.org/commons/axiom/OMTutorial.html
> >
> >
> > On 4/30/07, no spam <[EMAIL PROTECTED] > wrote:
> > >
> > >
> > > I've generated some ADB code from Microsoft SharePoint WSDL, using
> the ADB
> > > bindings. Can someone give me some basic orientation? Here are
> relevant
> > > details:
> > >
> > > a schema fragment (useless, imho) from the wsdl is is:
> > >
> > > <s:element name="GetListItemsResponse">
> > > <s:complexType>
> > > <s:sequence>
> > > <s:element minOccurs="0" maxOccurs="1"
> > > name="GetListItemsResult">
> > > <s:complexType mixed="true">
> > > <s:sequence>
> > > <s:any />
> > > </s:sequence>
> > > </s:complexType>
> > > </s:element>
> > > </s:sequence>
> > > </s:complexType>
> > > </s:element>
> > >
> > > there is a setViewFields() call which I'd like to make. It takes a
> > > ViewFields_type14, which also tells me nothing:
> > >
> > > public static class ViewFields_type14
> > > implements org.apache.axis2.databinding.ADBBean{
> > > /* This type was generated from the piece of schema that had
>
> > > name = viewFields_type14
> > > Namespace URI =
> > > http://schemas.microsoft.com/sharepoint/soap/
> > > Namespace Prefix = ns1
> > > */
> > > /**
> > > * field for ExtraElement
> > > */
> > > protected org.apache.axiom.om.OMElement
> > > localExtraElement ;
> > > /**
> > > * Auto generated getter method
> > > * @return org.apache.axiom.om.OMElement
> > > */
> > > public
> > org.apache.axiom.om.OMElement
> > > getExtraElement(){
> > > return localExtraElement;
> > > }
> > > /**
> > > * Auto generated setter
> > method
> > > * @param param
> > ExtraElement
> > > */
> > > public void
> > > setExtraElement(org.apache.axiom.om.OMElement param){
> > >
> > > this.localExtraElement=param;
> > > }
> > >
> > >
> > > the ADBBean interface also has nothing in it but a getPullParser()
> method.
> > > So how can I build up a ViewFields_type14 such that the Java
> compiler will
> > > be happy? I've spent at least an hour poring over the ADB
> documentation
> > and
> > > so far extracted nothing actionable. How about a code sample?
> > >
> > > Bob
> > >
> > >
> > > ________________________________
> > > Ahhh...imagining that irresistible "new car" smell?
> > > Check out new cars at Yahoo! Autos.
> > > ________________________________
> > > Ahhh...imagining that irresistible "new car" smell?
> > > Check out new cars at Yahoo! Autos.
> >
> >
> > --
> > Davanum Srinivas :: http://davanum.wordpress.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > ________________________________
> > Ahhh...imagining that irresistible "new car" smell?
> > Check out new cars at Yahoo! Autos.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ------------------------------
> Ahhh...imagining that irresistible "new car" smell?
> Check out new cars at Yahoo!
Autos.<http://us.rd.yahoo.com/evt=48245/*http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE1YW1jcXJ2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDbmV3LWNhcnM->
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Amila Suriarachchi,
WSO2 Inc.
--
Amila Suriarachchi,
WSO2 Inc.