Hi Chad,
I just tried out the user guide Axis2SampleDocLit sample and I was able
to invoke that service by using the client code given in the document.
I used the following client code fragment which is given in the user guide.
package org.apache.axis2.userguide;
public class testclient {
public static void main (String args[]){
try {
org.apache.axis2.userguide.Axis2SampleDocLitServiceStub stub
= new
org.apache.axis2.userguide.Axis2SampleDocLitServiceStub(null,
"http://localhost:8080/axis2/services/Axis2SampleDocLitService");
//Create the request document to be sent.
org.apache.axis2.userguide.xsd.EchoStringParamDocument reqDoc =
org.apache.axis2.userguide.xsd.EchoStringParamDocument.Factory.newInstance();
reqDoc.setEchoStringParam("Axis2 Echo");
//invokes the Web service.
org.apache.axis2.userguide.xsd.EchoStringReturnDocument
resDoc =
stub.echoString(reqDoc);
System.out.println(resDoc.getEchoStringReturn());
} catch (java.rmi.RemoteException e) {
e.printStackTrace();
}
try {
//Create the stub by passing the AXIS_HOME and target EPR.
//We pass null to the AXIS_HOME and hence the stub will use
the current directory as the AXIS_HOME
org.apache.axis2.userguide.Axis2SampleDocLitServiceStub stub =
new
org.apache.axis2.userguide.Axis2SampleDocLitServiceStub(null,
"http://localhost:8080/axis2/services/Axis2SampleDocLitService");
//Create the request document to be sent.
org.apache.axis2.userguide.xsd.EchoStringArrayParamDocument
reqDoc =
org.apache.axis2.userguide.xsd.EchoStringArrayParamDocument.Factory.newInstance();
org.apache.axis2.userguide.xsd.ArrayOfstringLiteral
paramArray =
org.apache.axis2.userguide.xsd.ArrayOfstringLiteral.Factory.newInstance();
paramArray.addString("Axis2");
paramArray.addString("Echo");
reqDoc.setEchoStringArrayParam(paramArray);
org.apache.axis2.userguide.xsd.EchoStringArrayReturnDocument
resDoc =
stub.echoStringArray(reqDoc);
//Get the response params
String[] resParams =
resDoc.getEchoStringArrayReturn().getStringArray();
for (int i = 0; i < resParams.length; i++) {
System.out.println(resParams[i]);
}
} catch (java.rmi.RemoteException e) {
e.printStackTrace();
}
try {
//Create the stub by passing the AXIS_HOME and target EPR.
//We pass null to the AXIS_HOME and hence the stub will use the
current directory as the AXIS_HOME
org.apache.axis2.userguide.Axis2SampleDocLitServiceStub stub =
new
org.apache.axis2.userguide.Axis2SampleDocLitServiceStub(null,
"http://localhost:8080/axis2/services/Axis2SampleDocLitService");
//Create the request Document
org.apache.axis2.userguide.xsd.EchoStructParamDocument
reqDoc =
org.apache.axis2.userguide.xsd.EchoStructParamDocument.Factory.newInstance();
//Create the complex type
org.apache.axis2.userguide.xsd.SOAPStruct reqStruct =
org.apache.axis2.userguide.xsd.SOAPStruct.Factory.newInstance();
reqStruct.setVarFloat(100.50F);
reqStruct.setVarInt(10);
reqStruct.setVarString("High");
reqDoc.setEchoStructParam(reqStruct);
//Service invocation
org.apache.axis2.userguide.xsd.EchoStructReturnDocument
resDoc =
stub.echoStruct(reqDoc);
org.apache.axis2.userguide.xsd.SOAPStruct resStruct =
resDoc.getEchoStructReturn();
System.out.println("floot Value :" + resStruct.getVarFloat());
System.out.println("int Value :" + resStruct.getVarInt());
System.out.println("String Value :" +
resStruct.getVarString());
} catch (java.rmi.RemoteException e) {
e.printStackTrace();
}
}
}
Can you please make sure your client code is correct?
Regards
Charitha
ChadDavis wrote:
As per the user guide, I'm trying to run the client and web service
built from Axis2SampleDocLit.wsdl
When I run the client I get a null pointer exception as follows:
Exception in thread "main" java.lang.NullPointerException
at
org.apache.axis2.description.ClientUtils.inferInTransport(ClientUtils.java:85)
at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:253)
at
org.apache.axis2.userguide.Axis2SampleDocLitServiceStub.echoString(Axis2SampleDocLitServiceStub.java:494)
at chad.test.ClientTester.main(ClientTester.java:20)
I'd appreciate any insight that you might have.
---------------------------------------------------------------------
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]