Hi again,

I've been experimenting using RPCServiceClient above and find that I can successfully invoke the service from a Java application, but not from within a Tomcat webapp.

It doesn't like that I pass a filled Object array containing the webservice method arguments. Like so:

*
   // ------------ Code --------------------

   Object[] operationArguments = new Object[] { "userName", "userCode" };

Object[] response = serviceClient.invokeBlocking( opTestService, operationArguments, returnTypes ); // ------------- End Code -------------- *


However I can pass an empty Object array without problem ( Object[] operationArguments = new Object[] { }; ).

Are there any know issues invoking a service in this way?

Here is us the full error trace:


   // ------------ Code --------------------

java.lang.NullPointerException
at com.ctc.wstx.sw.BaseNsStreamWriter.doWriteDefaultNs(BaseNsStreamWriter.java:528) at com.ctc.wstx.sw.SimpleNsStreamWriter.writeDefaultNamespace(SimpleNsStreamWriter.java:111) at com.ctc.wstx.sw.SimpleNsStreamWriter.writeNamespace(SimpleNsStreamWriter.java:119) at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeNamespace(MTOMXMLStreamWriter.java:146) at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeStartpart(OMSerializerUtil.java:329) at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeStartpart(OMSerializerUtil.java:171) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:804) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:837) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:808) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:837) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:808) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:837) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:808) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:179) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:837) at org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:417) at org.apache.axis2.transport.http.SOAPOverHTTPSender$AxisSOAPRequestEntity.handleOMOutput(SOAPOverHTTPSender.java:190) at org.apache.axis2.transport.http.SOAPOverHTTPSender$AxisSOAPRequestEntity.writeRequest(SOAPOverHTTPSender.java:232) at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:495) at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1973) at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346) at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:541) at org.apache.axis2.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java:119) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:335) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:204)
   at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:674)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:237) at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:579) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508) at org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:95)

   // ------------- End Code --------------


Regards, Alan Sunley.





Deepal Jayasinghe wrote:
Hi Alan ,

I hope you will get a Rampart release soon.

Thanks
Deepal
Hi folks,

I was able to successfully deploy and consume a POJO-based webservice
by closely following the POJO guide on the Axis2-1.2 site.  However I
need to include a username/password token in each message, therefore I
need to use Rampart. Unfortunately the current version of Rampart
(1.1) doesn't appear to be compatible with Axis2-1.2, so I have to
roll back to Axis2-1.1.1, and it is here that I have run into a host
of problems.

Firstly I don't seem to be able to access the service at all using the
same RPCServiceClient call (as I was able to with version 1.2):


       // ------------ Code --------------------

      RPCServiceClient serviceClient = new RPCServiceClient();
      Options options = serviceClient.getOptions();
      EndpointReference targetEPR = new
EndpointReference("http://localhost:8085/axis2/services/LPService";);
      options.setTo(targetEPR);
               QName opName = new
QName("http://services.example.com/xsd";, "getVendors");

       Object[] opGetVendorsArgs = new Object[] { "_null" };
       Class[] returnTypes = new Class[] {
com.example.schema.Vendor[].class };
                 Object[] response =
serviceClient.invokeBlocking(opGetVendorsr, opGetVendrosArgs,
returnTypes);
                com.example.schema.Vendor[] result =
(com.example.schema.Vendor[]) response[0];

      // ------------- End Code --------------

For this I receive the following error, before the request is sent to
the service:

java.lang.NullPointerException
  at
com.ctc.wstx.sw.BaseNsStreamWriter.doWriteDefaultNs(BaseNsStreamWriter.java:528)



I have also tried invoking the service this way:

         // ------------ Code --------------------

      OMFactory factory = OMAbstractFactory.getOMFactory();
      OMNamespace ns =
factory.createOMNamespace("http://services.example.com/xsd","ns1";);
      OMElement elementToSend = factory.createOMElement("getVendors",
ns);
      OMElement childElem = factory.createOMElement("param0", null);
      childElem.setText("_null");
       elem.addChild(childElem);

      ServiceClient client = new ServiceClient();
      Options options = new Options();
      options.setAction("urn:echo");
      options.setTo(new EndpointReference(endpointURL));
      client.setOptions(options);
      OMElement response = client.sendReceive(elementToSend);       //
------------- End Code --------------

This approach hits me with the following error, although this error
occurs on the server side when constructing the response.


  24-May-2007 21:05:04
org.apache.axis2.rpc.receivers.RPCMessageReceiver invokeBusinessLogic
  SEVERE: Exception occurred while trying to invoke service method
getVendors
  org.apache.axiom.om.OMException: java.lang.NullPointerException
          at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:194)

          at
org.apache.axiom.om.impl.llom.OMNodeImpl.build(OMNodeImpl.java:318)
          at
org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:632)
          at
org.apache.axiom.om.impl.llom.OMElementImpl.detach(OMElementImpl.java:599)

          at
org.apache.axiom.om.impl.llom.OMNodeImpl.setParent(OMNodeImpl.java:117)
          at
org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:249)

          at
org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:202)

          at
org.apache.axis2.rpc.receivers.RPCUtil.processResponse(RPCUtil.java:169)
          at
org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic
          ...



Anyone have any ideas on what could be causing the above two issues?
Any help would be greatly appreciated.

Regards,
Alan Sunley.






---------------------------------------------------------------------
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