|
Hello XinJun: Sorry the zip files I sent was returned since it is not accepted.So I have atatched the individual files in this email: The client files generated by the wsdl2java are: AnyTypeArrayTest.java AnyTypeArrayTestServiceTestCase.java AnyTypeArrayTestService.java SimpleJavaBean.java AnyTypeArrayTestServiceLocator.java TestAnyTypeSoapBindingStub.java Main Client Test Program: Please look at the file: AnyTypeArrayTestServiceTestCase method: test2TestAnyTypeGetSimpleBean() The wsdl file is : wsdl part of the program should refer to the line 70 in TestAnytype.wsdl and eventually to the definition of the SimpleBean which is line 14: <complexType name="SimpleJavaBean"> <sequence> <element name="name" nillable="true" type="xsd:string"/> <element name="value" nillable="true" type="xsd:anyType"/> </sequence> </complexType> The server.confif that describes the services looks like below: <service name="TestAnyType" provider="java:RPC" style="wrapped" use="literal"> <namespace>http://testanytype.webservice.com</namespace> <parameter name="allowedMethods" value="*"/> <parameter name="scope" value="request"/> <parameter name="className" value="test.AnyTypeArrayTest"/> <beanMapping languageSpecificType="java:test.SimpleBean" xmlns:ns="http://testanytype.webservice.com" qname="ns:SimpleJavaBean"/> </service> Eventually I want to use this webservice pblished using axis from a .NET client. Thanks for your help in advance, Ravi Xinjun Chen wrote:
|
TestAnyType.wsdl
Description: application/xml
/** * TestAnyTypeSoapBindingStub.java * * This file was auto-generated from WSDL * by the Apache Axis 1.2.1 Jun 14, 2005 (09:15:57 EDT) WSDL2Java emitter. */
package com.webservice.testanytype;
public class TestAnyTypeSoapBindingStub extends org.apache.axis.client.Stub implements com.webservice.testanytype.AnyTypeArrayTest {
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;
org.apache.axis.description.ParameterDesc param;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("setSimpleBean");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://testanytype.webservice.com", "bean"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://testanytype.webservice.com", "SimpleJavaBean"), com.webservice.testanytype.SimpleJavaBean.class, false, false);
oper.addParameter(param);
oper.setReturnType(org.apache.axis.encoding.XMLType.AXIS_VOID);
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[0] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("getSimpleBean");
oper.setReturnType(new javax.xml.namespace.QName("http://testanytype.webservice.com", "SimpleJavaBean"));
oper.setReturnClass(com.webservice.testanytype.SimpleJavaBean.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://testanytype.webservice.com", "getSimpleBeanReturn"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[1] = oper;
}
public TestAnyTypeSoapBindingStub() throws org.apache.axis.AxisFault {
this(null);
}
public TestAnyTypeSoapBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
this(service);
super.cachedEndpoint = endpointURL;
}
public TestAnyTypeSoapBindingStub(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;
}
((org.apache.axis.client.Service)super.service).setTypeMappingVersion("1.2");
java.lang.Class cls;
javax.xml.namespace.QName qName;
javax.xml.namespace.QName qName2;
java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
qName = new javax.xml.namespace.QName("http://testanytype.webservice.com", "SimpleJavaBean");
cachedSerQNames.add(qName);
cls = com.webservice.testanytype.SimpleJavaBean.class;
cachedSerClasses.add(cls);
cachedSerFactories.add(beansf);
cachedDeserFactories.add(beandf);
}
protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
try {
org.apache.axis.client.Call _call = super._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));
}
// All the type mapping information is registered
// when the first call is made.
// The type mapping information is actually registered in
// the TypeMappingRegistry of the service, which
// is the reason why registration is only needed for the first call.
synchronized (this) {
if (firstCall()) {
// must set encoding style before registering serializers
_call.setEncodingStyle(null);
for (int i = 0; i < cachedSerFactories.size(); ++i) {
java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
javax.xml.namespace.QName qName =
(javax.xml.namespace.QName) cachedSerQNames.get(i);
java.lang.Object x = cachedSerFactories.get(i);
if (x instanceof Class) {
java.lang.Class sf = (java.lang.Class)
cachedSerFactories.get(i);
java.lang.Class df = (java.lang.Class)
cachedDeserFactories.get(i);
_call.registerTypeMapping(cls, qName, sf, df, false);
}
else if (x instanceof javax.xml.rpc.encoding.SerializerFactory) {
org.apache.axis.encoding.SerializerFactory sf = (org.apache.axis.encoding.SerializerFactory)
cachedSerFactories.get(i);
org.apache.axis.encoding.DeserializerFactory df = (org.apache.axis.encoding.DeserializerFactory)
cachedDeserFactories.get(i);
_call.registerTypeMapping(cls, qName, sf, df, false);
}
}
}
}
return _call;
}
catch (java.lang.Throwable _t) {
throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t);
}
}
public void setSimpleBean(com.webservice.testanytype.SimpleJavaBean bean) 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("");
_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("http://testanytype.webservice.com", "setSimpleBean"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {bean});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
extractAttachments(_call);
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
public com.webservice.testanytype.SimpleJavaBean getSimpleBean() 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("");
_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("http://testanytype.webservice.com", "getSimpleBean"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (com.webservice.testanytype.SimpleJavaBean) _resp;
} catch (java.lang.Exception _exception) {
return (com.webservice.testanytype.SimpleJavaBean) org.apache.axis.utils.JavaUtils.convert(_resp, com.webservice.testanytype.SimpleJavaBean.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
}
/**
* AnyTypeArrayTest.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.2.1 Jun 14, 2005 (09:15:57 EDT) WSDL2Java emitter.
*/
package com.webservice.testanytype;
public interface AnyTypeArrayTest extends java.rmi.Remote {
public void setSimpleBean(com.webservice.testanytype.SimpleJavaBean bean) throws java.rmi.RemoteException;
public com.webservice.testanytype.SimpleJavaBean getSimpleBean() throws java.rmi.RemoteException;
}
/**
* AnyTypeArrayTestService.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.2.1 Jun 14, 2005 (09:15:57 EDT) WSDL2Java emitter.
*/
package com.webservice.testanytype;
public interface AnyTypeArrayTestService extends javax.xml.rpc.Service {
public java.lang.String getTestAnyTypeAddress();
public com.webservice.testanytype.AnyTypeArrayTest getTestAnyType() throws javax.xml.rpc.ServiceException;
public com.webservice.testanytype.AnyTypeArrayTest getTestAnyType(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
}
/**
* AnyTypeArrayTestServiceLocator.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.2.1 Jun 14, 2005 (09:15:57 EDT) WSDL2Java emitter.
*/
package com.webservice.testanytype;
public class AnyTypeArrayTestServiceLocator extends org.apache.axis.client.Service implements com.webservice.testanytype.AnyTypeArrayTestService {
public AnyTypeArrayTestServiceLocator() {
}
public AnyTypeArrayTestServiceLocator(org.apache.axis.EngineConfiguration config) {
super(config);
}
public AnyTypeArrayTestServiceLocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException {
super(wsdlLoc, sName);
}
// Use to get a proxy class for TestAnyType
private java.lang.String TestAnyType_address = "http://10.1.5.229:6415/axis/services/TestAnyType";
public java.lang.String getTestAnyTypeAddress() {
return TestAnyType_address;
}
// The WSDD service name defaults to the port name.
private java.lang.String TestAnyTypeWSDDServiceName = "TestAnyType";
public java.lang.String getTestAnyTypeWSDDServiceName() {
return TestAnyTypeWSDDServiceName;
}
public void setTestAnyTypeWSDDServiceName(java.lang.String name) {
TestAnyTypeWSDDServiceName = name;
}
public com.webservice.testanytype.AnyTypeArrayTest getTestAnyType() throws javax.xml.rpc.ServiceException {
java.net.URL endpoint;
try {
endpoint = new java.net.URL(TestAnyType_address);
}
catch (java.net.MalformedURLException e) {
throw new javax.xml.rpc.ServiceException(e);
}
return getTestAnyType(endpoint);
}
public com.webservice.testanytype.AnyTypeArrayTest getTestAnyType(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
try {
com.webservice.testanytype.TestAnyTypeSoapBindingStub _stub = new com.webservice.testanytype.TestAnyTypeSoapBindingStub(portAddress, this);
_stub.setPortName(getTestAnyTypeWSDDServiceName());
return _stub;
}
catch (org.apache.axis.AxisFault e) {
return null;
}
}
public void setTestAnyTypeEndpointAddress(java.lang.String address) {
TestAnyType_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 (com.webservice.testanytype.AnyTypeArrayTest.class.isAssignableFrom(serviceEndpointInterface)) {
com.webservice.testanytype.TestAnyTypeSoapBindingStub _stub = new com.webservice.testanytype.TestAnyTypeSoapBindingStub(new java.net.URL(TestAnyType_address), this);
_stub.setPortName(getTestAnyTypeWSDDServiceName());
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 ("TestAnyType".equals(inputPortName)) {
return getTestAnyType();
}
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://testanytype.webservice.com", "AnyTypeArrayTestService");
}
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://testanytype.webservice.com", "TestAnyType"));
}
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 ("TestAnyType".equals(portName)) {
setTestAnyTypeEndpointAddress(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);
}
}
/**
* AnyTypeArrayTestServiceTestCase.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.2.1 Jun 14, 2005 (09:15:57 EDT) WSDL2Java emitter.
*/
package com.webservice.testanytype;
public class AnyTypeArrayTestServiceTestCase extends junit.framework.TestCase {
public AnyTypeArrayTestServiceTestCase(java.lang.String name) {
super(name);
}
public void testTestAnyTypeWSDL() throws Exception {
javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();
java.net.URL url = new java.net.URL(new com.webservice.testanytype.AnyTypeArrayTestServiceLocator().getTestAnyTypeAddress() + "?WSDL");
javax.xml.rpc.Service service = serviceFactory.createService(url, new com.webservice.testanytype.AnyTypeArrayTestServiceLocator().getServiceName());
assertTrue(service != null);
}
public void test1TestAnyTypeSetSimpleBean() throws Exception {
com.webservice.testanytype.TestAnyTypeSoapBindingStub binding;
try {
binding = (com.webservice.testanytype.TestAnyTypeSoapBindingStub)
new com.webservice.testanytype.AnyTypeArrayTestServiceLocator().getTestAnyType();
}
catch (javax.xml.rpc.ServiceException jre) {
if(jre.getLinkedCause()!=null)
jre.getLinkedCause().printStackTrace();
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
assertNotNull("binding is null", binding);
// Time out after a minute
binding.setTimeout(60000);
// Test operation
binding.setSimpleBean(new com.webservice.testanytype.SimpleJavaBean());
// TBD - validate results
}
public void test2TestAnyTypeGetSimpleBean() throws Exception {
com.webservice.testanytype.TestAnyTypeSoapBindingStub binding;
try {
binding = (com.webservice.testanytype.TestAnyTypeSoapBindingStub)
new com.webservice.testanytype.AnyTypeArrayTestServiceLocator().getTestAnyType();
}
catch (javax.xml.rpc.ServiceException jre) {
if(jre.getLinkedCause()!=null)
jre.getLinkedCause().printStackTrace();
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
assertNotNull("binding is null", binding);
// Time out after a minute
binding.setTimeout(60000);
// Test operation
com.webservice.testanytype.SimpleJavaBean value = null;
value = binding.getSimpleBean();
System.out.println(" value is " + value);
// TBD - validate results
}
}
/**
* SimpleJavaBean.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.2.1 Jun 14, 2005 (09:15:57 EDT) WSDL2Java emitter.
*/
package com.webservice.testanytype;
public class SimpleJavaBean implements java.io.Serializable {
private java.lang.String name;
private java.lang.Object value;
public SimpleJavaBean() {
}
public SimpleJavaBean(
java.lang.String name,
java.lang.Object value) {
this.name = name;
this.value = value;
}
/**
* Gets the name value for this SimpleJavaBean.
*
* @return name
*/
public java.lang.String getName() {
return name;
}
/**
* Sets the name value for this SimpleJavaBean.
*
* @param name
*/
public void setName(java.lang.String name) {
this.name = name;
}
/**
* Gets the value value for this SimpleJavaBean.
*
* @return value
*/
public java.lang.Object getValue() {
return value;
}
/**
* Sets the value value for this SimpleJavaBean.
*
* @param value
*/
public void setValue(java.lang.Object value) {
this.value = value;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof SimpleJavaBean)) return false;
SimpleJavaBean other = (SimpleJavaBean) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.name==null && other.getName()==null) ||
(this.name!=null &&
this.name.equals(other.getName()))) &&
((this.value==null && other.getValue()==null) ||
(this.value!=null &&
this.value.equals(other.getValue())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getName() != null) {
_hashCode += getName().hashCode();
}
if (getValue() != null) {
_hashCode += getValue().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(SimpleJavaBean.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://testanytype.webservice.com", "SimpleJavaBean"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("name");
elemField.setXmlName(new javax.xml.namespace.QName("http://testanytype.webservice.com", "name"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("value");
elemField.setXmlName(new javax.xml.namespace.QName("http://testanytype.webservice.com", "value"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "anyType"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
