|
Using Axis 1.0 RC2, WebLogic 7.0.1, and EJB Provider. Deployed a HelloWorld stateless session bean with a hello() method that returns a String. No problem calling it from a Java client using JNDI. Now exposed this EJB as a Web Service. Assume this was done successfully because I could get the WSDL file from http://localhost:8080/axis/services/HelloEJBService?wsdl. Used the WSDL2Java util to generate all the client-side service locator and SOAP binding stub classes. Wrote my little test client using these classes. Ran this test class, got AxisFault with underlying NullPointerException. Then tried a VB6 client using MSXML.XMLHttpRequest object and posting a SOAP request. Got the same AxisFault back. Has anyone successfully used the Axis EJB Provider with WebLogic? My code is attached. Thanks.
Eric Ma
|
SOAPClient.bas
Description: Binary data
deploy.wsdd
Description: Binary data
/** * Hello.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */
public interface Hello extends java.rmi.Remote {
public java.lang.String hello() throws java.rmi.RemoteException;
}
<?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://localhost:8080/axis/services/HelloEJBService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/axis/services/HelloEJBService" xmlns:intf="http://localhost:8080/axis/services/HelloEJBService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><wsdl:types/> <wsdl:message name="helloRequest"> </wsdl:message> <wsdl:message name="helloResponse"> <wsdl:part name="helloReturn" type="xsd:string"/> </wsdl:message> <wsdl:portType name="Hello"> <wsdl:operation name="hello"> <wsdl:input message="impl:helloRequest" name="helloRequest"/> <wsdl:output message="impl:helloResponse" name="helloResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="HelloEJBServiceSoapBinding" type="impl:Hello"> <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="hello"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="helloRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/HelloEJBService" use="encoded"/> </wsdl:input> <wsdl:output name="helloResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/HelloEJBService" use="encoded"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="HelloService"> <wsdl:port binding="impl:HelloEJBServiceSoapBinding" name="HelloEJBService"> <wsdlsoap:address location="http://localhost:8080/axis/services/HelloEJBService"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
/**
* HelloEJBServiceSoapBindingStub.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/
public class HelloEJBServiceSoapBindingStub extends org.apache.axis.client.Stub implements Hello {
private java.util.Vector cachedSerClasses = new java.util.Vector();
private java.util.Vector cachedSerQNames = new java.util.Vector();
private java.util.Vector cachedSerFactories = new java.util.Vector();
private java.util.Vector cachedDeserFactories = new java.util.Vector();
public HelloEJBServiceSoapBindingStub() throws org.apache.axis.AxisFault {
this(null);
}
public HelloEJBServiceSoapBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
this(service);
super.cachedEndpoint = endpointURL;
}
public HelloEJBServiceSoapBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
if (service == null) {
super.service = new org.apache.axis.client.Service();
} else {
super.service = service;
}
}
private org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
try {
org.apache.axis.client.Call _call =
(org.apache.axis.client.Call) super.service.createCall();
if (super.maintainSessionSet) {
_call.setMaintainSession(super.maintainSession);
}
if (super.cachedUsername != null) {
_call.setUsername(super.cachedUsername);
}
if (super.cachedPassword != null) {
_call.setPassword(super.cachedPassword);
}
if (super.cachedEndpoint != null) {
_call.setTargetEndpointAddress(super.cachedEndpoint);
}
if (super.cachedTimeout != null) {
_call.setTimeout(super.cachedTimeout);
}
if (super.cachedPortName != null) {
_call.setPortName(super.cachedPortName);
}
java.util.Enumeration keys = super.cachedProperties.keys();
while (keys.hasMoreElements()) {
java.lang.String key = (java.lang.String) keys.nextElement();
if(_call.isPropertySupported(key))
_call.setProperty(key, super.cachedProperties.get(key));
else
_call.setScopedProperty(key, super.cachedProperties.get(key));
}
return _call;
}
catch (java.lang.Throwable t) {
throw new org.apache.axis.AxisFault("Failure trying to get the Call object", t);
}
}
public java.lang.String hello() throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setOperationStyle("rpc");
_call.setOperationName(new javax.xml.namespace.QName("http://localhost:8080/axis/services/HelloEJBService", "hello"));
java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
}
}
/**
* HelloService.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/
public interface HelloService extends javax.xml.rpc.Service {
public java.lang.String getHelloEJBServiceAddress();
public Hello getHelloEJBService() throws javax.xml.rpc.ServiceException;
public Hello getHelloEJBService(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
}
/**
* HelloServiceLocator.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/
public class HelloServiceLocator extends org.apache.axis.client.Service implements HelloService {
// Use to get a proxy class for HelloEJBService
private final java.lang.String HelloEJBService_address = "http://localhost:8080/axis/services/HelloEJBService";
public java.lang.String getHelloEJBServiceAddress() {
return HelloEJBService_address;
}
// The WSDD service name defaults to the port name.
private java.lang.String HelloEJBServiceWSDDServiceName = "HelloEJBService";
public java.lang.String getHelloEJBServiceWSDDServiceName() {
return HelloEJBServiceWSDDServiceName;
}
public void setHelloEJBServiceWSDDServiceName(java.lang.String name) {
HelloEJBServiceWSDDServiceName = name;
}
public Hello getHelloEJBService() throws javax.xml.rpc.ServiceException {
java.net.URL endpoint;
try {
endpoint = new java.net.URL(HelloEJBService_address);
}
catch (java.net.MalformedURLException e) {
return null; // unlikely as URL was validated in WSDL2Java
}
return getHelloEJBService(endpoint);
}
public Hello getHelloEJBService(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
try {
HelloEJBServiceSoapBindingStub _stub = new HelloEJBServiceSoapBindingStub(portAddress, this);
_stub.setPortName(getHelloEJBServiceWSDDServiceName());
return _stub;
}
catch (org.apache.axis.AxisFault e) {
return null;
}
}
/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
try {
if (Hello.class.isAssignableFrom(serviceEndpointInterface)) {
HelloEJBServiceSoapBindingStub _stub = new HelloEJBServiceSoapBindingStub(new java.net.URL(HelloEJBService_address), this);
_stub.setPortName(getHelloEJBServiceWSDDServiceName());
return _stub;
}
}
catch (java.lang.Throwable t) {
throw new javax.xml.rpc.ServiceException(t);
}
throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
}
/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
java.rmi.Remote _stub = getPort(serviceEndpointInterface);
((org.apache.axis.client.Stub) _stub).setPortName(portName);
return _stub;
}
public javax.xml.namespace.QName getServiceName() {
return new javax.xml.namespace.QName("http://localhost:8080/axis/services/HelloEJBService", "HelloService");
}
private java.util.HashSet ports = null;
public java.util.Iterator getPorts() {
if (ports == null) {
ports = new java.util.HashSet();
ports.add(new javax.xml.namespace.QName("HelloEJBService"));
}
return ports.iterator();
}
}
import org.apache.axis.AxisFault;
public class HelloServiceTest
{
public static void main (String[] args) throws Exception
{
try
{
HelloService service = new HelloServiceLocator();
Hello hello = service.getHelloEJBService();
String hi = hello.hello();
System.out.println(hi);
}
catch(AxisFault af)
{
System.err.println(af.dumpToString());
}
}
}
