where did you get the NPE , I mean the line ?

I think that should be here  " return res.getFirstElement().getText();"

So probably res.getFirstElement() should be null. If you can send the request via the TCP monitor and see what happen.

Thank you,
Deepal
Hi,
I'm new to Axis2. As my first Axis2 web service project I followed the
quickstart in creating/deploying a web service and writing a client to
access the service. Here's my client code: -------------------------web service client---------------------------
  public class CSXStub {
    private String query;
public CSXStub() {
      this.query = null;
    }

    public void setQuery(String qry) {
      this.query = qry;
    }

    public String getQuery(){
      // create request payload
      OMFactory fac = OMAbstractFactory.getOMFactory();
      OMNamespace ns =
fac.createOMNamespace("http://ws.apache.org/axis2/xsd";, "ns1");
      OMElement method = fac.createOMElement("Search", ns);
      OMElement value = fac.createOMElement("query", ns);

      value.addChild(fac.createOMText(value, query));
      method.addChild(value);

      // create service client
      ServiceClient client;
      OMElement res;

      try {
        client = new ServiceClient();
      } catch (AxisFault e) {
        return "Failed creating Axis2 client object: " + e.getMessage();
      }

      // create option object
      Options opts = new Options();

      //setting target end point reference
      EndpointReference epr = new EndpointReference(
"http://localhost:8080/axis2/services/CSXService";);
      opts.setTo(epr);

      //Setting action, and which can be found from the wsdl of the
service
      opts.setAction("urn:echo"); */
      client.setOptions(opts);

      // invoking service
      try {
        res = client.sendReceive(method);
      } catch (AxisFault e) {
        return "Failed calling CSX web service: " + e.getMessage();
      }

      return res.getFirstElement().getText();
    }
  }
----------------------------------------------------------------------

I imported this class into a JSP page. In invoking that JSP the last
catch fired and returned the error message:

  Failed calling CSX web service: java.lang.NullPointerException

What did I go wrong here?

Thanks,
Yigang

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






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

Reply via email to