Upul,

thank you very much, that has fixed it.

Much appreciated,

Chris

Upul Godage wrote:
Hi,

This will work.

public static OMElement createQuery(){
        OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace aon = factory.createOMNamespace(" http://www.aoi.com/WSDA/0.1","ao";); OMElement wsdaQueryNode = factory.createOMElement("wsdaQuery", aon, null); wsdaQueryNode.addAttribute("name", "campaign.getProductSkuId ", aon);
        OMElement param = factory.createOMElement("param", aon, null);
        param.addAttribute("skuId", "6949", aon);
        wsdaQueryNode.addChild(param);
      return wsdaQueryNode;
}

Upul

On 10/10/07, *Chris Bowman* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Hi,
    I am trying to add a simple child element to an OMElement I have
    created, but I am getting a null pointer. I am using the same syntax I
    have seen in the Axiom OM Tutorial
    ( http://ws.apache.org/axis2/1_0/OMTutorial.html), and am using
    Axis 2 1.3.

    The code I try is:

    public static OMElement createQuery(){
           OMNamespace aon = new
    OMNamespaceImpl(" http://www.aoi.com/WSDA/0.1";, "ao");
           OMElement wsdaQueryNode = new OMElementImpl("wsdaQuery",
    aon, null);
           wsdaQueryNode.addAttribute("name",
    "campaign.getProductSkuId ", aon);
           OMElement param = new OMElementImpl("param", aon, null);
           param.addAttribute("skuId", "6949", aon);
           param.addChild(param);
           return wsdaQueryNode;
    }

    The error I get is:

    java.lang.NullPointerException
    Error: java.lang.NullPointerException
       at
    org.apache.axiom.om.impl.builder.StAXOMBuilder.<init>(StAXOMBuilder.java:64)

       at
    org.apache.axiom.om.impl.llom.OMNodeImpl.importNode(OMNodeImpl.java:455)
       at
    org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:197)

       at
    com.aoi.ws.clients.test.WSDATestClient.createQuery
    (WSDATestClient.java:55)
       at
    com.aoi.ws.clients.test.WSDATestClient.main(WSDATestClient.java:27)

    Any ideas would be much appreciated.

    Regards,

    Chris

    --

    Chris Bowman
    Director, Phoros Limited
    mobile: +44(0)7766 881 564
    email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    For additional commands, e-mail: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>



--

Chris Bowman
Director, Phoros Limited
mobile: +44(0)7766 881 564
email: [EMAIL PROTECTED]

Reply via email to