On Wed, Oct 15, 2008 at 5:24 AM, Tian Chi <[EMAIL PROTECTED]> wrote:

> Hi all,
>
> I'm new at using Axis2. Don't know how to do this?
> Can anyone give me some guidance about this or tell me
> where to find examples/documents about this?
>
> Basically I need to provide a web service and the client program (a SOAP
> client not using Axis2) will post an XML file to the service. The service
> program should save the data in the XML file to my database and respond with
> result message to the client.
>
> I noticed in the Axis2 'Quick Start Guide', there's an example about
> building the service using AXIOM. I wonder if that's the way to do it.
>
> The function is like
>
>    public OMElement getPrice(OMElement element) throws XMLStreamException {
>        element.build();
>        element.detach();
>
>        OMElement symbolElement = element.getFirstElement();
>        String symbol = symbolElement.getText();
>
>        String returnText = "42";
>        Double price = (Double) map.get(symbol);
>        if(price != null){
>            returnText  = "" + price.doubleValue();
>        }
>        OMFactory fac = OMAbstractFactory.getOMFactory();
>        OMNamespace omNs =
>            fac.createOMNamespace("
> http://axiom.service.quickstart.samples/xsd";, "tns");
>        OMElement method = fac.createOMElement("getPriceResponse", omNs);
>        OMElement value = fac.createOMElement("price", omNs);
>        value.addChild(fac.createOMText(value, returnText));
>        method.addChild(value);
>        return method;
>    }
>
> Does this mean the 'element' object is the XML element sent from the client
> program?

This is what comes under the SoapBody in your request in case it is soap
binding. for an HTTP binding this is the xml payload it has received.



>
>
> Also do I need to do anything else to write (OutputStream stuff) the
> returned object 'method' to the client?


No. Axis2 do it automatically.

thanks,
Amila.

>
>
> thanks in advance,
>
> -tian
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Reply via email to