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 Mona Yazbeck <mo...@hec.ca> on 2006/06/01 17:26:45 UTC
Re: Help on creating a MessageElement
It's working now, thanks for the help!
I had to put my variable "namespaceUri" to empty to get it work.
And I had to call the getAsString() method from the first element of my
messageelement (me[0].getAsString();)
Thanks again, it is really appreciated!
Mona
----- Message d'origine -----
De : "Mona Yazbeck" <mo...@hec.ca>
À : <ax...@ws.apache.org>
Envoyé : 31 mai 2006 16:25
Objet : Re: Help on creating a MessageElement
> Thanks! But one more question, I have to put this in the message element:
>
> <Batch OnError="Return">
> <Method ID="1" Cmd="New">
> <Field Name="Title">nom</Field>
> <Field Name="FirstName">FirstName</Field>
> <Field Name="Email">email@domain.com</Field>
> </Method>
> </Batch>
>
> I wrote this, but I know I got a mistake somewhere... I don't think it
> output the right XML. (I am trying to use getAsString() to see the output,
> without success)
>
> MessageElement me[] = new MessageElement[1];
> me[0] = new MessageElement (new QName(namespaceUri, "Batch"));
> me[0].addAttribute(namespaceUri, "OnError", "Return");
> MessageElement method = (MessageElement)me[0].addChildElement("Method");
> method.addAttribute(namespaceUri, "ID", "1");
> method.addAttribute(namespaceUri, "Cmd", "New");
> MessageElement title = (MessageElement)method.addChildElement("Title");
> title.addTextNode("Nom");
> MessageElement firstname =
> (MessageElement)method.addChildElement("FirstName");
> firstname.addTextNode("First Name");
> MessageElement email = (MessageElement)method.addChildElement("Email");
> email.addTextNode("email@domain.com");
>
> Thank you so much.
>
> Mona
>
>
> ----- Message d'origine -----
> De : "Jaka Mocnik" <ja...@xlab.si>
> À : <ax...@ws.apache.org>
> Envoyé : 31 mai 2006 14:16
> Objet : Re: Help on creating a MessageElement
>
>
>> On Wed, 2006-05-31 at 13:50 -0400, Mona Yazbeck wrote:
>>> Hi Jaka,
>>>
>>> I get a compilation error when trying to call my constructor with the
>>> root
>>> element. I guess it's because the constructor is waiting for a
>>> MessageElement[] (an array).
>>> cannot resolve symbol
>>> symbol: constructor
>>> UpdateListItemsUpdates(org.apache.axis.message.MessageElement)
>> ok, I completely misunderstood you before.
>>
>> so you want to have a MessageElement[] array that represents the
>> children of the Method element you decribe in your original post?
>> simple:
>>
>> MessageElement me[] = new MessageElement[3];
>>
>> now for each me[0..2] create a new MessageElement:
>>
>> me[i] = new MessageElement(new QName(namespaceUri, elementName));
>>
>> add appropriate attributes:
>>
>> me[i].addAttribute(namespaceUri, attributeName, attributeValue);
>>
>> finally, add text content of the element:
>>
>> me[i].addTextNode(contentOfTheElement);
>>
>> I believe this will create the appropriate MessageElements...
>>
>> regards,
>> jaKa
>>
>> --
>> email: jaka@xlab.si
>> w3: http://fish.homeunix.org/people/jaka
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org