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]