seguinte… montei um webservice que soma dois numeros…
public class web {
public Integer soma(Integer a, Integer b) {
return (new Integer(a.intValue() + b.intValue()));
}
}
e um cliente pra consumir esse webservice…
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class Teste {
public static void main(String[] args) {
try {
String url = "http://localhost:8080/axis/web.jws";
Object param[] = {new Integer(10), new Integer(10)};
Service s = new Service();
Call call = (Call) s.createCall();
call.setTargetEndpointAddress(url);
call.setOperationName("soma");
Integer ret = (Integer)call.invoke(param);
System.out.println("resultado: " + ret);
} catch (RemoteException e) {
System.out.println(e);
} catch (ServiceException e) {
System.out.println(e);
}
}
}
nessa linha:
Integer ret = (Integer)call.invoke(param);
da o seguinte erro:
[#text: 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:246)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
at org.apache.axis.client.Call.invoke(Call.java:2553)
at org.apache.axis.client.Call.invoke(Call.java:2248)
at org.apache.axis.client.Call.invoke(Call.java:2171)
at org.apache.axis.client.Call.invoke(Call.java:1691)
at teste.Teste.main(Teste.java:41)
bom, o WSDL mostra normal. Mas tem esse erro no log do tomcat
- Unable to find config file. Creating new servlet engine config file: /WEB-INF/server-config.wsdd
realmente num tem msm esse arquivo. oq eu faço?