I'm starting study Web services and I'm trying to use a client to test
the web service that I just create and I'm receiving the follow error
em I execute the client program. I'm using Eclipse 3.2 and
Jboss4.0.1ps1
The client source is :
Code:
package com.myapp;
import javax.xml.namespace.QName;
import javax.xml.rpc.Call;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.ParameterMode;
public class DIIClient {
// modified from sun j2ee jaxrpc example
private static String endpoint = "http://localhost:8080/simple-ws4ee/
ws4ee/services/HelloWorld";
private static String qnameService = "HelloWorldService";
private static String qnamePort = "HelloWorld";
private static String ENCODING_STYLE_PROPERTY
="javax.xml.rpc.encodingstyle.namespace.uri";
private static String NS_XSD = "http://www.w3.org/2001/XMLSchema";
private static String URI_ENCODING = "http://schemas.xmlsoap.org/
soap/encoding/";
public static void main(String[] args) {
System.out.println("Endpoint address = " + endpoint);
try {
ServiceFactory factory = ServiceFactory.newInstance();
Service service = factory.createService(new
QName(qnameService));
QName port = new QName(qnamePort);
Call call = service.createCall(port);
call.setTargetEndpointAddress(endpoint);
call.setProperty(Call.SOAPACTION_USE_PROPERTY, new
Boolean(true));
call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
call.setProperty(ENCODING_STYLE_PROPERTY, URI_ENCODING);
QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");
call.setReturnType(QNAME_TYPE_STRING);
call.setOperationName(new QName(endpoint,
"getHelloWorld"));
call.addParameter("String_1", QNAME_TYPE_STRING,
ParameterMode.IN);
String[] params = { "jboss!" };
String result = (String)call.invoke(params);
System.out.println(result);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
The error is:
Code:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
faultSubcode:
faultString: java.lang.NullPointerException
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:
java.lang.NullPointerException
at java.util.Hashtable.put(Unknown Source)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.setProperty(Unknown
Source)
at
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:
263)
at org.apache.axis.MessagePart.getAsSOAPEnvelope(MessagePart.java:
657)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:430)
at org.apache.axis.Message.getContentType(Message.java:496)
at
org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:
386)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:
126)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:
73)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:160)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:123)
at org.jboss.webservice.client.ClientEngine.invoke(ClientEngine.java:
126)
at org.apache.axis.client.Call.invokeEngine(Call.java:3029)
at org.apache.axis.client.Call.invoke(Call.java:3014)
at org.apache.axis.client.Call.invoke(Call.java:2608)
at org.apache.axis.client.Call.invoke(Call.java:2513)
at org.apache.axis.client.Call.invokeInternal(Call.java:1973)
at org.apache.axis.client.Call.invoke(Call.java:1914)
at org.jboss.webservice.client.CallImpl.invoke(CallImpl.java:265)
at com.myapp.DIIClient.main(DIIClient.java:47)
org.apache.axis.AxisFault: java.lang.NullPointerException
at org.apache.axis.AxisFault.makeFault(AxisFault.java:146)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:
136)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:
73)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:160)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:123)
at org.jboss.webservice.client.ClientEngine.invoke(ClientEngine.java:
126)
at org.apache.axis.client.Call.invokeEngine(Call.java:3029)
at org.apache.axis.client.Call.invoke(Call.java:3014)
at org.apache.axis.client.Call.invoke(Call.java:2608)
at org.apache.axis.client.Call.invoke(Call.java:2513)
at org.apache.axis.client.Call.invokeInternal(Call.java:1973)
at org.apache.axis.client.Call.invoke(Call.java:1914)
at org.jboss.webservice.client.CallImpl.invoke(CallImpl.java:265)
at com.myapp.DIIClient.main(DIIClient.java:47)
Caused by: java.lang.NullPointerException
at java.util.Hashtable.put(Unknown Source)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.setProperty(Unknown
Source)
at
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:
263)
at org.apache.axis.MessagePart.getAsSOAPEnvelope(MessagePart.java:
657)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:430)
at org.apache.axis.Message.getContentType(Message.java:496)
at
org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:
386)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:
126)
... 12 more
When I test my web service with Eclipse Web services Explorer I
receive the right response. What is wrong with my client?
thanks,