You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Henry Lu <zh...@med.umich.edu> on 2004/10/15 14:02:39 UTC
new comments
Jayachandra, thanks for your info and time. But I have never had lock to
make things going. Here is my code:
package ws.Echo;
public interface Echo
{
public String echoString(String arg);
public String echoString_double(String arg1, String arg2);
}
////////////////////////////////////////////////////////////////////
wsdl file generaged by axis-java2wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://www.echo/wscr"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://www.echo/wscr" xmlns:intf="http://www.echo/wscr"
xmlns:tns1="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 created by Apache Axis version: 1.2RC1
Built on Sep 29, 2004 (08:29:40 EDT)-->
<wsdl:types>
<schema elementFormDefault="qualified"
targetNamespace="http://www.echo/wscr"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="in0" type="tns1:string"/>
<element name="echoStringReturn" type="tns1:string"/>
<element name="in1" type="tns1:string"/>
<element name="in2" type="tns1:string"/>
<element name="echoString_doubleReturn" type="tns1:string"/>
</schema>
</wsdl:types>
<wsdl:message name="echoStringResponse">
<wsdl:part element="impl:echoStringReturn"
name="echoStringReturn"/>
</wsdl:message>
<wsdl:message name="echoStringRequest">
<wsdl:part element="impl:in0" name="in0"/>
</wsdl:message>
<wsdl:message name="echoString_doubleResponse">
<wsdl:part element="impl:echoString_doubleReturn"
name="echoString_doubleReturn"/>
</wsdl:message>
<wsdl:message name="echoString_doubleRequest">
<wsdl:part element="impl:in1" name="in0"/>
<wsdl:part element="impl:in2" name="in1"/>
</wsdl:message>
<wsdl:portType name="Echo">
<wsdl:operation name="echoString" parameterOrder="in0">
<wsdl:input message="impl:echoStringRequest"
name="echoStringRequest"/>
<wsdl:output message="impl:echoStringResponse"
name="echoStringResponse"/>
</wsdl:operation>
<wsdl:operation name="echoString_double" parameterOrder="in0
in1">
<wsdl:input message="impl:echoString_doubleRequest"
name="echoString_doubleRequest"/>
<wsdl:output message="impl:echoString_doubleResponse"
name="echoString_doubleResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Echo" type="impl:Echo">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="echoString">
<wsdlsoap:operation soapAction="echoString"/>
<wsdl:input name="echoStringRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="echoStringResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="echoString_double">
<wsdlsoap:operation soapAction="echoString_double"/>
<wsdl:input name="echoString_doubleRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="echoString_doubleResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="EchoService">
<wsdl:port binding="impl:Echo" name="Echo">
<wsdlsoap:address
location="http://localhost:8088/axis/services/Echo"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
///////////////////////////////////////////////////////////////////////////////
wsdd file generaged by axis-wsdl2java:
<deployment
xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<!-- Services from EchoService WSDL service -->
<service name="Echo" provider="java:RPC" style="document"
use="literal">
<parameter name="wsdlTargetNamespace"
value="http://www.echo/wscr"/>
<parameter name="wsdlServiceElement" value="EchoService"/>
<parameter name="wsdlServicePort" value="Echo"/>
<parameter name="className" value="ws.Echo.EchoSkeleton"/>
<parameter name="wsdlPortType" value="Echo"/>
<parameter name="allowedMethods" value="*"/>
<parameter name="scope" value="Session"/>
</service>
</deployment>
//////////////////////////////////////////////////////////////
imp file generated by axis-wsdl2java:
package ws.Echo;
public class EchoImpl implements ws.Echo.Echo{
public java.lang.String echoString(java.lang.String in0) throws
java.rmi.RemoteException {
return null;
}
public java.lang.String echoString_double(java.lang.String in0,
java.lang.String in1) throws java.rmi.RemoteException {
return null;
}
}
/////////////////////////////////////////////////////////////////////
service file:
package ws.Echo;
public interface EchoService extends javax.xml.rpc.Service {
public java.lang.String getEchoAddress();
public ws.Echo.Echo getEcho() throws
javax.xml.rpc.ServiceException;
public ws.Echo.Echo getEcho(java.net.URL portAddress) throws
javax.xml.rpc.ServiceException;
}
///////////////////////////////////////////////////////////////////////////
skeleton file:
package ws.Echo;
public class EchoSkeleton implements ws.Echo.Echo,
org.apache.axis.wsdl.Skeleton {
private ws.Echo.Echo impl;
private static java.util.Map _myOperations = new
java.util.Hashtable();
private static java.util.Collection _myOperationsList = new
java.util.ArrayList();
/**
* Returns List of OperationDesc objects with this name
*/
public static java.util.List
getOperationDescByName(java.lang.String methodName) {
return (java.util.List)_myOperations.get(methodName);
}
/**
* Returns Collection of OperationDescs
*/
public static java.util.Collection getOperationDescs() {
return _myOperationsList;
}
static {
org.apache.axis.description.OperationDesc _oper;
org.apache.axis.description.FaultDesc _fault;
org.apache.axis.description.ParameterDesc [] _params;
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new
javax.xml.namespace.QName("http://www.echo/wscr", "in0"),
org.apache.axis.description.ParameterDesc.IN, new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/",
"string"), java.lang.String.class, false, false),
};
_oper = new
org.apache.axis.description.OperationDesc("echoString", _params, new
javax.xml.namespace.QName("http://www.echo/wscr", "echoStringReturn"));
_oper.setReturnType(new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/",
"string"));
_oper.setElementQName(new javax.xml.namespace.QName("",
"echoString"));
_oper.setSoapAction("echoString");
_myOperationsList.add(_oper);
if (_myOperations.get("echoString") == null) {
_myOperations.put("echoString", new
java.util.ArrayList());
}
((java.util.List)_myOperations.get("echoString")).add(_oper);
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new
javax.xml.namespace.QName("http://www.echo/wscr", "in1"),
org.apache.axis.description.ParameterDesc.IN, new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/",
"string"), java.lang.String.class, false, false),
new org.apache.axis.description.ParameterDesc(new
javax.xml.namespace.QName("http://www.echo/wscr", "in2"),
org.apache.axis.description.ParameterDesc.IN, new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/",
"string"), java.lang.String.class, false, false),
};
_oper = new
org.apache.axis.description.OperationDesc("echoString_double", _params,
new javax.xml.namespace.QName("http://www.echo/wscr",
"echoString_doubleReturn"));
_oper.setReturnType(new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/",
"string"));
_oper.setElementQName(new javax.xml.namespace.QName("",
"echoString_double"));
_oper.setSoapAction("echoString_double");
_myOperationsList.add(_oper);
if (_myOperations.get("echoString_double") == null) {
_myOperations.put("echoString_double", new
java.util.ArrayList());
}
((java.util.List)_myOperations.get("echoString_double")).add(_oper);
}
public EchoSkeleton() {
this.impl = new ws.Echo.EchoImpl();
}
public EchoSkeleton(ws.Echo.Echo impl) {
this.impl = impl;
}
public java.lang.String echoString(java.lang.String in0) throws
java.rmi.RemoteException
{
java.lang.String ret = impl.echoString(in0);
return ret;
}
public java.lang.String echoString_double(java.lang.String in0,
java.lang.String in1) throws java.rmi.RemoteException
{
java.lang.String ret = impl.echoString_double(in0, in1);
return ret;
}
}
//////////////////////////////////////////////////////////////////////////////
locator file:
package ws.Echo;
public class EchoServiceLocator extends org.apache.axis.client.Service
implements ws.Echo.EchoService {
// Use to get a proxy class for Echo
private java.lang.String Echo_address =
"http://localhost:8088/axis/services/Echo";
public java.lang.String getEchoAddress() {
return Echo_address;
}
// The WSDD service name defaults to the port name.
private java.lang.String EchoWSDDServiceName = "Echo";
public java.lang.String getEchoWSDDServiceName() {
return EchoWSDDServiceName;
}
public void setEchoWSDDServiceName(java.lang.String name) {
EchoWSDDServiceName = name;
}
public ws.Echo.Echo getEcho() throws javax.xml.rpc.ServiceException
{
java.net.URL endpoint;
try {
endpoint = new java.net.URL(Echo_address);
}
catch (java.net.MalformedURLException e) {
throw new javax.xml.rpc.ServiceException(e);
}
return getEcho(endpoint);
}
public ws.Echo.Echo getEcho(java.net.URL portAddress) throws
javax.xml.rpc.ServiceException {
try {
ws.Echo.EchoStub _stub = new ws.Echo.EchoStub(portAddress,
this);
_stub.setPortName(getEchoWSDDServiceName());
return _stub;
}
catch (org.apache.axis.AxisFault e) {
return null;
}
}
public void setEchoEndpointAddress(java.lang.String address) {
Echo_address = address;
}
/**
* 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
(ws.Echo.Echo.class.isAssignableFrom(serviceEndpointInterface)) {
ws.Echo.EchoStub _stub = new ws.Echo.EchoStub(new
java.net.URL(Echo_address), this);
_stub.setPortName(getEchoWSDDServiceName());
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 {
if (portName == null) {
return getPort(serviceEndpointInterface);
}
java.lang.String inputPortName = portName.getLocalPart();
if ("Echo".equals(inputPortName)) {
return getEcho();
}
else {
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://www.echo/wscr",
"EchoService");
}
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("http://www.echo/wscr", "Echo"));
}
return ports.iterator();
}
/**
* Set the endpoint address for the specified port name.
*/
public void setEndpointAddress(java.lang.String portName,
java.lang.String address) throws javax.xml.rpc.ServiceException {
if ("Echo".equals(portName)) {
setEchoEndpointAddress(address);
}
else { // Unknown Port Name
throw new javax.xml.rpc.ServiceException(" Cannot set
Endpoint Address for Unknown Port" + portName);
}
}
/**
* Set the endpoint address for the specified port name.
*/
public void setEndpointAddress(javax.xml.namespace.QName portName,
java.lang.String address) throws javax.xml.rpc.ServiceException {
setEndpointAddress(portName.getLocalPart(), address);
}
}
///////////////////////////////////////////////////////////////////////////
stub file:
package ws.Echo;
public class EchoStub extends org.apache.axis.client.Stub implements
ws.Echo.Echo {
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();
static org.apache.axis.description.OperationDesc [] _operations;
static {
_operations = new
org.apache.axis.description.OperationDesc[2];
_initOperationDesc1();
}
private static void _initOperationDesc1(){
org.apache.axis.description.OperationDesc oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("echoString");
oper.addParameter(new
javax.xml.namespace.QName("http://www.echo/wscr", "in0"), new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/",
"string"), java.lang.String.class,
org.apache.axis.description.ParameterDesc.IN, false, false);
oper.setReturnType(new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/",
"string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new
javax.xml.namespace.QName("http://www.echo/wscr", "echoStringReturn"));
oper.setStyle(org.apache.axis.enum.Style.DOCUMENT);
oper.setUse(org.apache.axis.enum.Use.LITERAL);
_operations[0] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("echoString_double");
oper.addParameter(new
javax.xml.namespace.QName("http://www.echo/wscr", "in1"), new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/",
"string"), java.lang.String.class,
org.apache.axis.description.ParameterDesc.IN, false, false);
oper.addParameter(new
javax.xml.namespace.QName("http://www.echo/wscr", "in2"), new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/",
"string"), java.lang.String.class,
org.apache.axis.description.ParameterDesc.IN, false, false);
oper.setReturnType(new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/",
"string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new
javax.xml.namespace.QName("http://www.echo/wscr",
"echoString_doubleReturn"));
oper.setStyle(org.apache.axis.enum.Style.DOCUMENT);
oper.setUse(org.apache.axis.enum.Use.LITERAL);
_operations[1] = oper;
}
public EchoStub() throws org.apache.axis.AxisFault {
this(null);
}
public EchoStub(java.net.URL endpointURL, javax.xml.rpc.Service
service) throws org.apache.axis.AxisFault {
this(service);
super.cachedEndpoint = endpointURL;
}
public EchoStub(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();
_call.setProperty(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 echoString(java.lang.String in0) throws
java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[0]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("echoString");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("",
"echoString"));
setRequestHeaders(_call);
setAttachments(_call);
java.lang.Object _resp = _call.invoke(new java.lang.Object[]
{in0});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
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);
}
}
}
public java.lang.String echoString_double(java.lang.String in0,
java.lang.String in1) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[1]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("echoString_double");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("",
"echoString_double"));
setRequestHeaders(_call);
setAttachments(_call);
java.lang.Object _resp = _call.invoke(new java.lang.Object[]
{in0, in1});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
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);
}
}
}
}
//////////////////////////////////////////////////////////////////////////////
When I use tcpmoni to see the soap code, it seams to me that the client
side code
is fine and I did see string "10" and "12" passed in the envelope. But
on the server size, I couldn't see the string "12", it was null. And the
tomcat server displayed
the following errors:
java.io.NotSerializableException: ws.Echo.EchoImpl
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java
:1332)
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:13
04)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.jav
a:1247)
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
at
org.apache.catalina.session.StandardSession.writeObject(StandardSessi
So I suspected that wsdl2java generates skeleton code with some error.
-Henry
P.S. Could you zip your entire code and send to me so I can make
comparison between your and mine?