antelder 2003/01/03 02:41:41 Added: java/test/interop/wsifservice ComplexDocument_Type.java interopdocLocal.wsdl ArrayOfSimpleDocument.java InteropDocSvcLocator.java Doc_Test_BindingStub.java InteropDocSvcTestCase.java interopdoc.wsdl SimpleDocument_Type.java SingleTag_Type.java Doc_TestPortType.java InteropDocSvc.java ChildDocument.java java/test/interop InteropDocTest.java Log: Add interop tests for document style Revision Changes Path 1.1 xml-axis-wsif/java/test/interop/wsifservice/ComplexDocument_Type.java Index: ComplexDocument_Type.java =================================================================== /** * ComplexDocument_Type.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package interop.wsifservice; public class ComplexDocument_Type implements java.io.Serializable { private interop.wsifservice.ArrayOfSimpleDocument simpleDoc; private interop.wsifservice.ChildDocument child; private java.lang.String anAttribute; // attribute public ComplexDocument_Type() { } public interop.wsifservice.ArrayOfSimpleDocument getSimpleDoc() { return simpleDoc; } public void setSimpleDoc(interop.wsifservice.ArrayOfSimpleDocument simpleDoc) { this.simpleDoc = simpleDoc; } public interop.wsifservice.ChildDocument getChild() { return child; } public void setChild(interop.wsifservice.ChildDocument child) { this.child = child; } public java.lang.String getAnAttribute() { return anAttribute; } public void setAnAttribute(java.lang.String anAttribute) { this.anAttribute = anAttribute; } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof ComplexDocument_Type)) return false; ComplexDocument_Type other = (ComplexDocument_Type) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((simpleDoc==null && other.getSimpleDoc()==null) || (simpleDoc!=null && simpleDoc.equals(other.getSimpleDoc()))) && ((child==null && other.getChild()==null) || (child!=null && child.equals(other.getChild()))) && ((anAttribute==null && other.getAnAttribute()==null) || (anAttribute!=null && anAttribute.equals(other.getAnAttribute()))); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = 1; if (getSimpleDoc() != null) { _hashCode += getSimpleDoc().hashCode(); } if (getChild() != null) { _hashCode += getChild().hashCode(); } if (getAnAttribute() != null) { _hashCode += getAnAttribute().hashCode(); } __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(ComplexDocument_Type.class); static { org.apache.axis.description.FieldDesc field = new org.apache.axis.description.AttributeDesc(); field.setFieldName("anAttribute"); field.setXmlName(new javax.xml.namespace.QName("", "AnAttribute")); field.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); typeDesc.addFieldDesc(field); field = new org.apache.axis.description.ElementDesc(); field.setFieldName("simpleDoc"); field.setXmlName(new javax.xml.namespace.QName("http://soapinterop.org/", "simpleDoc")); field.setXmlType(new javax.xml.namespace.QName("http://soapinterop.org/", "ArrayOfSimpleDocument")); field.setMinOccursIs0(true); typeDesc.addFieldDesc(field); field = new org.apache.axis.description.ElementDesc(); field.setFieldName("child"); field.setXmlName(new javax.xml.namespace.QName("http://soapinterop.org/", "child")); field.setXmlType(new javax.xml.namespace.QName("http://soapinterop.org/", "ChildDocument")); field.setMinOccursIs0(true); typeDesc.addFieldDesc(field); }; /** * 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); } } 1.1 xml-axis-wsif/java/test/interop/wsifservice/interopdocLocal.wsdl Index: interopdocLocal.wsdl =================================================================== <?xml version="1.0"?> <definitions name="InteropTestDoc" targetNamespace="http://soapinterop.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://soapinterop.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <types> <xsd:schema elementFormDefault="qualified" targetNamespace="http://soapinterop.org/" xmlns:interop="http://soapinterop.org/"> <xsd:element name="SingleTag"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="SingleTag" type="interop:SingleTag"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="SingleTag"/> <xsd:element name="SingleTagResponse"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="SingleTag" type="interop:SingleTag"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="SimpleDocument"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="SimpleDocument" type="interop:SimpleDocument"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="SimpleDocument"> <xsd:simpleContent> <xsd:extension base="xsd:string"/> </xsd:simpleContent> </xsd:complexType> <xsd:element name="SimpleDocumentResponse"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="SimpleDocument" type="interop:SimpleDocument"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="ComplexDocument"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="ComplexDocument" type="interop:ComplexDocument"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="ComplexDocument"> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="simpleDoc" type="interop:ArrayOfSimpleDocument"/> <xsd:element minOccurs="0" maxOccurs="1" name="child" type="interop:ChildDocument"/> </xsd:sequence> <xsd:attribute name="AnAttribute" type="xsd:string"/> </xsd:complexType> <xsd:complexType name="ArrayOfSimpleDocument"> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="unbounded" name="SimpleDocument" nillable="true" type="interop:SimpleDocument"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="ChildDocument"> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="childSimpleDoc" type="interop:ArrayOfSimpleDocument"/> </xsd:sequence> </xsd:complexType> <xsd:element name="ComplexDocumentResponse"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="ComplexDocument" type="interop:ComplexDocument"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </types> <message name="SingleTagSoapIn"> <part name="parameters" element="tns:SingleTag"/> </message> <message name="SingleTagSoapOut"> <part name="outputDoc" element="tns:SingleTagResponse"/> </message> <message name="SimpleDocumentSoapIn"> <part name="parameters" element="tns:SimpleDocument"/> </message> <message name="SimpleDocumentSoapOut"> <part name="outputDoc" element="tns:SimpleDocumentResponse"/> </message> <message name="ComplexDocumentSoapIn"> <part name="parameters" element="tns:ComplexDocument"/> </message> <message name="ComplexDocumentSoapOut"> <part name="outputDoc" element="tns:ComplexDocumentResponse"/> </message> <portType name="Doc_TestPortType"> <operation name="SingleTag"> <input message="tns:SingleTagSoapIn"/> <output message="tns:SingleTagSoapOut"/> </operation> <operation name="SimpleDocument"> <input message="tns:SimpleDocumentSoapIn"/> <output message="tns:SimpleDocumentSoapOut"/> </operation> <operation name="ComplexDocument"> <input message="tns:ComplexDocumentSoapIn"/> <output message="tns:ComplexDocumentSoapOut"/> </operation> </portType> <binding name="doc_test_binding" type="tns:Doc_TestPortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="SingleTag"> <soap:operation soapAction="http://soapinterop.org/SingleTag"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> <operation name="SimpleDocument"> <soap:operation soapAction="http://soapinterop.org/SimpleDocument"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> <operation name="ComplexDocument"> <soap:operation soapAction="http://soapinterop.org/ComplexDocument"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> <service name="interopDocSvc"> <port name="interopDocPort" binding="tns:doc_test_binding"> <!-- <soap:address location="http://www.whitemesa.net/interopdoc"/> --> <!-- <soap:address location="http://localhost:8080/soap/servlet/rpcrouter"/> --> <soap:address location="http://localhost:8080/interopdoc"/> </port> </service> </definitions> 1.1 xml-axis-wsif/java/test/interop/wsifservice/ArrayOfSimpleDocument.java Index: ArrayOfSimpleDocument.java =================================================================== /** * ArrayOfSimpleDocument.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package interop.wsifservice; public class ArrayOfSimpleDocument implements java.io.Serializable { private interop.wsifservice.SimpleDocument_Type[] simpleDocument; public ArrayOfSimpleDocument() { } public interop.wsifservice.SimpleDocument_Type[] getSimpleDocument() { return simpleDocument; } public void setSimpleDocument(interop.wsifservice.SimpleDocument_Type[] simpleDocument) { this.simpleDocument = simpleDocument; } public interop.wsifservice.SimpleDocument_Type getSimpleDocument(int i) { return simpleDocument[i]; } public void setSimpleDocument(int i, interop.wsifservice.SimpleDocument_Type value) { this.simpleDocument[i] = value; } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof ArrayOfSimpleDocument)) return false; ArrayOfSimpleDocument other = (ArrayOfSimpleDocument) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((simpleDocument==null && other.getSimpleDocument()==null) || (simpleDocument!=null && java.util.Arrays.equals(simpleDocument, other.getSimpleDocument()))); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = 1; if (getSimpleDocument() != null) { for (int i=0; i<java.lang.reflect.Array.getLength(getSimpleDocument()); i++) { java.lang.Object obj = java.lang.reflect.Array.get(getSimpleDocument(), i); if (obj != null && !obj.getClass().isArray()) { _hashCode += obj.hashCode(); } } } __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(ArrayOfSimpleDocument.class); static { org.apache.axis.description.FieldDesc field = new org.apache.axis.description.ElementDesc(); field.setFieldName("simpleDocument"); field.setXmlName(new javax.xml.namespace.QName("http://soapinterop.org/", "SimpleDocument")); field.setMinOccursIs0(true); typeDesc.addFieldDesc(field); }; /** * 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); } } 1.1 xml-axis-wsif/java/test/interop/wsifservice/InteropDocSvcLocator.java Index: InteropDocSvcLocator.java =================================================================== /** * InteropDocSvcLocator.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package interop.wsifservice; public class InteropDocSvcLocator extends org.apache.axis.client.Service implements interop.wsifservice.InteropDocSvc { // Use to get a proxy class for interopDocPort private final java.lang.String interopDocPort_address = "http://www.whitemesa.net/interopdoc"; public java.lang.String getinteropDocPortAddress() { return interopDocPort_address; } // The WSDD service name defaults to the port name. private java.lang.String interopDocPortWSDDServiceName = "interopDocPort"; public java.lang.String getinteropDocPortWSDDServiceName() { return interopDocPortWSDDServiceName; } public void setinteropDocPortWSDDServiceName(java.lang.String name) { interopDocPortWSDDServiceName = name; } public interop.wsifservice.Doc_TestPortType getinteropDocPort() throws javax.xml.rpc.ServiceException { java.net.URL endpoint; try { endpoint = new java.net.URL(interopDocPort_address); } catch (java.net.MalformedURLException e) { return null; // unlikely as URL was validated in WSDL2Java } return getinteropDocPort(endpoint); } public interop.wsifservice.Doc_TestPortType getinteropDocPort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException { try { interop.wsifservice.Doc_Test_BindingStub _stub = new interop.wsifservice.Doc_Test_BindingStub(portAddress, this); _stub.setPortName(getinteropDocPortWSDDServiceName()); 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 (interop.wsifservice.Doc_TestPortType.class.isAssignableFrom(serviceEndpointInterface)) { interop.wsifservice.Doc_Test_BindingStub _stub = new interop.wsifservice.Doc_Test_BindingStub(new java.net.URL(interopDocPort_address), this); _stub.setPortName(getinteropDocPortWSDDServiceName()); 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://soapinterop.org/", "interopDocSvc"); } 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("interopDocPort")); } return ports.iterator(); } } 1.1 xml-axis-wsif/java/test/interop/wsifservice/Doc_Test_BindingStub.java Index: Doc_Test_BindingStub.java =================================================================== /** * Doc_Test_BindingStub.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package interop.wsifservice; public class Doc_Test_BindingStub extends org.apache.axis.client.Stub implements interop.wsifservice.Doc_TestPortType { 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 Doc_Test_BindingStub() throws org.apache.axis.AxisFault { this(null); } public Doc_Test_BindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault { this(service); super.cachedEndpoint = endpointURL; } public Doc_Test_BindingStub(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; } java.lang.Class cls; javax.xml.namespace.QName qName; 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; qName = new javax.xml.namespace.QName("http://soapinterop.org/", "ArrayOfSimpleDocument"); cachedSerQNames.add(qName); cls = interop.wsifservice.ArrayOfSimpleDocument.class; cachedSerClasses.add(cls); cachedSerFactories.add(beansf); cachedDeserFactories.add(beandf); qName = new javax.xml.namespace.QName("http://soapinterop.org/", "ChildDocument"); cachedSerQNames.add(qName); cls = interop.wsifservice.ChildDocument.class; cachedSerClasses.add(cls); cachedSerFactories.add(beansf); cachedDeserFactories.add(beandf); qName = new javax.xml.namespace.QName("http://soapinterop.org/", "SingleTag"); cachedSerQNames.add(qName); cls = interop.wsifservice.SingleTag_Type.class; cachedSerClasses.add(cls); cachedSerFactories.add(beansf); cachedDeserFactories.add(beandf); qName = new javax.xml.namespace.QName("http://soapinterop.org/", "ComplexDocument"); cachedSerQNames.add(qName); cls = interop.wsifservice.ComplexDocument_Type.class; cachedSerClasses.add(cls); cachedSerFactories.add(beansf); cachedDeserFactories.add(beandf); qName = new javax.xml.namespace.QName("http://soapinterop.org/", "SimpleDocument"); cachedSerQNames.add(qName); cls = interop.wsifservice.SimpleDocument_Type.class; cachedSerClasses.add(cls); cachedSerFactories.add(simplesf); cachedDeserFactories.add(simpledf); } 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)); } // 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.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); } } } return _call; } catch (java.lang.Throwable t) { throw new org.apache.axis.AxisFault("Failure trying to get the Call object", t); } } public interop.wsifservice.SingleTag_Type singleTag(interop.wsifservice.SingleTag_Type singleTag) throws java.rmi.RemoteException { if (super.cachedEndpoint == null) { throw new org.apache.axis.NoEndPointException(); } org.apache.axis.client.Call _call = createCall(); _call.addParameter(new javax.xml.namespace.QName("http://soapinterop.org/", "SingleTag"), new javax.xml.namespace.QName("http://soapinterop.org/", "SingleTag"), interop.wsifservice.SingleTag_Type.class, javax.xml.rpc.ParameterMode.IN); _call.setReturnType(new javax.xml.namespace.QName("http://soapinterop.org/", "SingleTag"), interop.wsifservice.SingleTag_Type.class); _call.setUseSOAPAction(true); _call.setSOAPActionURI("http://soapinterop.org/SingleTag"); _call.setEncodingStyle(null); _call.setScopedProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE); _call.setScopedProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE); _call.setOperationStyle("wrapped"); _call.setOperationName(new javax.xml.namespace.QName("http://soapinterop.org/", "SingleTag")); _call.setReturnQName(new javax.xml.namespace.QName("http://soapinterop.org/", "SingleTag")); java.lang.Object _resp = _call.invoke(new java.lang.Object[] {singleTag}); if (_resp instanceof java.rmi.RemoteException) { throw (java.rmi.RemoteException)_resp; } else { try { return (interop.wsifservice.SingleTag_Type) _resp; } catch (java.lang.Exception _exception) { return (interop.wsifservice.SingleTag_Type) org.apache.axis.utils.JavaUtils.convert(_resp, interop.wsifservice.SingleTag_Type.class); } } } public interop.wsifservice.SimpleDocument_Type simpleDocument(interop.wsifservice.SimpleDocument_Type simpleDocument) throws java.rmi.RemoteException { if (super.cachedEndpoint == null) { throw new org.apache.axis.NoEndPointException(); } org.apache.axis.client.Call _call = createCall(); _call.addParameter(new javax.xml.namespace.QName("http://soapinterop.org/", "SimpleDocument"), new javax.xml.namespace.QName("http://soapinterop.org/", "SimpleDocument"), interop.wsifservice.SimpleDocument_Type.class, javax.xml.rpc.ParameterMode.IN); _call.setReturnType(new javax.xml.namespace.QName("http://soapinterop.org/", "SimpleDocument"), interop.wsifservice.SimpleDocument_Type.class); _call.setUseSOAPAction(true); _call.setSOAPActionURI("http://soapinterop.org/SimpleDocument"); _call.setEncodingStyle(null); _call.setScopedProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE); _call.setScopedProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE); _call.setOperationStyle("wrapped"); _call.setOperationName(new javax.xml.namespace.QName("http://soapinterop.org/", "SimpleDocument")); _call.setReturnQName(new javax.xml.namespace.QName("http://soapinterop.org/", "SimpleDocument")); java.lang.Object _resp = _call.invoke(new java.lang.Object[] {simpleDocument}); if (_resp instanceof java.rmi.RemoteException) { throw (java.rmi.RemoteException)_resp; } else { try { return (interop.wsifservice.SimpleDocument_Type) _resp; } catch (java.lang.Exception _exception) { return (interop.wsifservice.SimpleDocument_Type) org.apache.axis.utils.JavaUtils.convert(_resp, interop.wsifservice.SimpleDocument_Type.class); } } } public interop.wsifservice.ComplexDocument_Type complexDocument(interop.wsifservice.ComplexDocument_Type complexDocument) throws java.rmi.RemoteException { if (super.cachedEndpoint == null) { throw new org.apache.axis.NoEndPointException(); } org.apache.axis.client.Call _call = createCall(); _call.addParameter(new javax.xml.namespace.QName("http://soapinterop.org/", "ComplexDocument"), new javax.xml.namespace.QName("http://soapinterop.org/", "ComplexDocument"), interop.wsifservice.ComplexDocument_Type.class, javax.xml.rpc.ParameterMode.IN); _call.setReturnType(new javax.xml.namespace.QName("http://soapinterop.org/", "ComplexDocument"), interop.wsifservice.ComplexDocument_Type.class); _call.setUseSOAPAction(true); _call.setSOAPActionURI("http://soapinterop.org/ComplexDocument"); _call.setEncodingStyle(null); _call.setScopedProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE); _call.setScopedProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE); _call.setOperationStyle("wrapped"); _call.setOperationName(new javax.xml.namespace.QName("http://soapinterop.org/", "ComplexDocument")); _call.setReturnQName(new javax.xml.namespace.QName("http://soapinterop.org/", "ComplexDocument")); java.lang.Object _resp = _call.invoke(new java.lang.Object[] {complexDocument}); if (_resp instanceof java.rmi.RemoteException) { throw (java.rmi.RemoteException)_resp; } else { try { return (interop.wsifservice.ComplexDocument_Type) _resp; } catch (java.lang.Exception _exception) { return (interop.wsifservice.ComplexDocument_Type) org.apache.axis.utils.JavaUtils.convert(_resp, interop.wsifservice.ComplexDocument_Type.class); } } } } 1.1 xml-axis-wsif/java/test/interop/wsifservice/InteropDocSvcTestCase.java Index: InteropDocSvcTestCase.java =================================================================== /** * InteropDocSvcTestCase.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package interop.wsifservice; public class InteropDocSvcTestCase extends junit.framework.TestCase { public InteropDocSvcTestCase(java.lang.String name) { super(name); } public void test1interopDocPortSingleTag() { interop.wsifservice.Doc_TestPortType binding; try { binding = new interop.wsifservice.InteropDocSvcLocator().getinteropDocPort(); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertTrue("binding is null", binding != null); try { interop.wsifservice.SingleTag_Type value = null; value = binding.singleTag(new interop.wsifservice.SingleTag_Type()); } catch (java.rmi.RemoteException re) { throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re); } } public void test2interopDocPortSimpleDocument() { interop.wsifservice.Doc_TestPortType binding; try { binding = new interop.wsifservice.InteropDocSvcLocator().getinteropDocPort(); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertTrue("binding is null", binding != null); try { interop.wsifservice.SimpleDocument_Type value = null; value = binding.simpleDocument(new interop.wsifservice.SimpleDocument_Type()); } catch (java.rmi.RemoteException re) { throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re); } } public void test3interopDocPortComplexDocument() { interop.wsifservice.Doc_TestPortType binding; try { binding = new interop.wsifservice.InteropDocSvcLocator().getinteropDocPort(); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertTrue("binding is null", binding != null); try { interop.wsifservice.ComplexDocument_Type value = null; value = binding.complexDocument(new interop.wsifservice.ComplexDocument_Type()); } catch (java.rmi.RemoteException re) { throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re); } } } 1.1 xml-axis-wsif/java/test/interop/wsifservice/interopdoc.wsdl Index: interopdoc.wsdl =================================================================== <?xml version="1.0"?> <definitions name="InteropTestDoc" targetNamespace="http://soapinterop.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://soapinterop.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <types> <xsd:schema elementFormDefault="qualified" targetNamespace="http://soapinterop.org/" xmlns:interop="http://soapinterop.org/"> <xsd:element name="SingleTag"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="SingleTag" type="interop:SingleTag"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="SingleTag"/> <xsd:element name="SingleTagResponse"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="SingleTag" type="interop:SingleTag"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="SimpleDocument"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="SimpleDocument" type="interop:SimpleDocument"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="SimpleDocument"> <xsd:simpleContent> <xsd:extension base="xsd:string"/> </xsd:simpleContent> </xsd:complexType> <xsd:element name="SimpleDocumentResponse"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="SimpleDocument" type="interop:SimpleDocument"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="ComplexDocument"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="ComplexDocument" type="interop:ComplexDocument"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="ComplexDocument"> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="simpleDoc" type="interop:ArrayOfSimpleDocument"/> <xsd:element minOccurs="0" maxOccurs="1" name="child" type="interop:ChildDocument"/> </xsd:sequence> <xsd:attribute name="AnAttribute" type="xsd:string"/> </xsd:complexType> <xsd:complexType name="ArrayOfSimpleDocument"> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="unbounded" name="SimpleDocument" nillable="true" type="interop:SimpleDocument"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="ChildDocument"> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="childSimpleDoc" type="interop:ArrayOfSimpleDocument"/> </xsd:sequence> </xsd:complexType> <xsd:element name="ComplexDocumentResponse"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="ComplexDocument" type="interop:ComplexDocument"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </types> <message name="SingleTagSoapIn"> <part name="parameters" element="tns:SingleTag"/> </message> <message name="SingleTagSoapOut"> <part name="outputDoc" element="tns:SingleTagResponse"/> </message> <message name="SimpleDocumentSoapIn"> <part name="parameters" element="tns:SimpleDocument"/> </message> <message name="SimpleDocumentSoapOut"> <part name="outputDoc" element="tns:SimpleDocumentResponse"/> </message> <message name="ComplexDocumentSoapIn"> <part name="parameters" element="tns:ComplexDocument"/> </message> <message name="ComplexDocumentSoapOut"> <part name="outputDoc" element="tns:ComplexDocumentResponse"/> </message> <portType name="Doc_TestPortType"> <operation name="SingleTag"> <input message="tns:SingleTagSoapIn"/> <output message="tns:SingleTagSoapOut"/> </operation> <operation name="SimpleDocument"> <input message="tns:SimpleDocumentSoapIn"/> <output message="tns:SimpleDocumentSoapOut"/> </operation> <operation name="ComplexDocument"> <input message="tns:ComplexDocumentSoapIn"/> <output message="tns:ComplexDocumentSoapOut"/> </operation> </portType> <binding name="doc_test_binding" type="tns:Doc_TestPortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="SingleTag"> <soap:operation soapAction="http://soapinterop.org/SingleTag"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> <operation name="SimpleDocument"> <soap:operation soapAction="http://soapinterop.org/SimpleDocument"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> <operation name="ComplexDocument"> <soap:operation soapAction="http://soapinterop.org/ComplexDocument"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> <service name="interopDocSvc"> <port name="interopDocPort" binding="tns:doc_test_binding"> <soap:address location="http://www.whitemesa.net/interopdoc"/> </port> </service> </definitions> 1.1 xml-axis-wsif/java/test/interop/wsifservice/SimpleDocument_Type.java Index: SimpleDocument_Type.java =================================================================== /** * SimpleDocument_Type.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package interop.wsifservice; public class SimpleDocument_Type implements java.io.Serializable, org.apache.axis.encoding.SimpleType { private java.lang.String value; public SimpleDocument_Type() { } // Simple Types must have a String constructor public SimpleDocument_Type(java.lang.String value) { this.value = new java.lang.String(value); } // Simple Types must have a toString for serializing the value public java.lang.String toString() { return value == null ? null : value.toString(); } public java.lang.String getValue() { return value; } public void setValue(java.lang.String value) { this.value = value; } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof SimpleDocument_Type)) return false; SimpleDocument_Type other = (SimpleDocument_Type) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((value==null && other.getValue()==null) || (value!=null && 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 (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(SimpleDocument_Type.class); static { org.apache.axis.description.FieldDesc field = new org.apache.axis.description.ElementDesc(); field.setFieldName("value"); field.setXmlName(new javax.xml.namespace.QName("", "value")); field.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); typeDesc.addFieldDesc(field); }; /** * 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.SimpleSerializer( _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.SimpleDeserializer( _javaType, _xmlType, typeDesc); } } 1.1 xml-axis-wsif/java/test/interop/wsifservice/SingleTag_Type.java Index: SingleTag_Type.java =================================================================== /** * SingleTag_Type.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package interop.wsifservice; public class SingleTag_Type implements java.io.Serializable { public SingleTag_Type() { } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof SingleTag_Type)) return false; SingleTag_Type other = (SingleTag_Type) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true; __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = 1; __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(SingleTag_Type.class); /** * 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, null); } /** * 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, null); } } 1.1 xml-axis-wsif/java/test/interop/wsifservice/Doc_TestPortType.java Index: Doc_TestPortType.java =================================================================== /** * Doc_TestPortType.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package interop.wsifservice; public interface Doc_TestPortType extends java.rmi.Remote { public interop.wsifservice.SingleTag_Type singleTag(interop.wsifservice.SingleTag_Type singleTag) throws java.rmi.RemoteException; public interop.wsifservice.SimpleDocument_Type simpleDocument(interop.wsifservice.SimpleDocument_Type simpleDocument) throws java.rmi.RemoteException; public interop.wsifservice.ComplexDocument_Type complexDocument(interop.wsifservice.ComplexDocument_Type complexDocument) throws java.rmi.RemoteException; } 1.1 xml-axis-wsif/java/test/interop/wsifservice/InteropDocSvc.java Index: InteropDocSvc.java =================================================================== /** * InteropDocSvc.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package interop.wsifservice; public interface InteropDocSvc extends javax.xml.rpc.Service { public java.lang.String getinteropDocPortAddress(); public interop.wsifservice.Doc_TestPortType getinteropDocPort() throws javax.xml.rpc.ServiceException; public interop.wsifservice.Doc_TestPortType getinteropDocPort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException; } 1.1 xml-axis-wsif/java/test/interop/wsifservice/ChildDocument.java Index: ChildDocument.java =================================================================== /** * ChildDocument.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package interop.wsifservice; public class ChildDocument implements java.io.Serializable { private interop.wsifservice.ArrayOfSimpleDocument childSimpleDoc; public ChildDocument() { } public interop.wsifservice.ArrayOfSimpleDocument getChildSimpleDoc() { return childSimpleDoc; } public void setChildSimpleDoc(interop.wsifservice.ArrayOfSimpleDocument childSimpleDoc) { this.childSimpleDoc = childSimpleDoc; } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof ChildDocument)) return false; ChildDocument other = (ChildDocument) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((childSimpleDoc==null && other.getChildSimpleDoc()==null) || (childSimpleDoc!=null && childSimpleDoc.equals(other.getChildSimpleDoc()))); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = 1; if (getChildSimpleDoc() != null) { _hashCode += getChildSimpleDoc().hashCode(); } __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(ChildDocument.class); static { org.apache.axis.description.FieldDesc field = new org.apache.axis.description.ElementDesc(); field.setFieldName("childSimpleDoc"); field.setXmlName(new javax.xml.namespace.QName("http://soapinterop.org/", "childSimpleDoc")); field.setXmlType(new javax.xml.namespace.QName("http://soapinterop.org/", "ArrayOfSimpleDocument")); field.setMinOccursIs0(true); typeDesc.addFieldDesc(field); }; /** * 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); } } 1.1 xml-axis-wsif/java/test/interop/InteropDocTest.java Index: InteropDocTest.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "WSIF" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation and was * originally based on software copyright (c) 2001, 2002, International * Business Machines, Inc., http://www.apache.org. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package interop; import interop.wsifservice.ArrayOfSimpleDocument; import interop.wsifservice.ChildDocument; import interop.wsifservice.ComplexDocument_Type; import interop.wsifservice.SimpleDocument_Type; import interop.wsifservice.SingleTag_Type; import java.io.StringReader; import java.io.StringWriter; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import org.apache.wsif.WSIFException; import org.apache.wsif.WSIFMessage; import org.apache.wsif.WSIFOperation; import org.apache.wsif.WSIFPort; import org.apache.wsif.WSIFService; import org.apache.wsif.WSIFServiceFactory; import org.apache.xerces.parsers.DOMParser; import org.apache.xml.serialize.OutputFormat; import org.apache.xml.serialize.XMLSerializer; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import util.TestUtilities; import docStyle.wsifservice.ZipCodeResolverSoap; import docStyle.zipCodeNW.ShortZipCode; import docStyle.zipCodeNW.ShortZipCodeResponse; /** * Junit test to test out the AXIS provider docstyle support * * This test is part of the SOAP Builders interoperability testing * effort described at http://www.whitemesa.net/. The WSDL is * available online at http://www.whitemesa.net/wsdl/interopdoc.wsdl * * TODO: tests using wrapped parts * TODO: tests using stubs * TODO: tests using messaging * * @author Ant Elder <[EMAIL PROTECTED]> */ public class InteropDocTest extends TestCase { String wsdlLocation = TestUtilities.getWsdlPath("java\\test\\interop\\wsifservice") + "interopdoc.wsdl"; // + "interopdocLocal.wsdl"; // "http://www.whitemesa.net/wsdl/interopdoc.wsdl"; public InteropDocTest(String name) { super(name); } public static void main(String[] args) { // TestUtilities.startListeners( // TestUtilities.ADDRESSBOOK_LISTENER // | TestUtilities.ASYNC_LISTENER // | TestUtilities.NATIVEJMS_LISTENER); junit.textui.TestRunner.run(suite()); // TestUtilities.stopListeners(); } public static Test suite() { return new TestSuite(InteropDocTest.class); } public void setUp() { TestUtilities.setUpExtensionsAndProviders(); } public void testSingleTagDII() { doitSingleTagDII("interopDocPort", "axis"); } public void testSimpleDocumentDII() { doitSimpleDocumentDII("interopDocPort", "axis"); } public void testComplexDocumentDII() { doitComplexDocumentDII("interopDocPort", "axis"); } private void doitSingleTagDII(String portName, String protocol) { if (portName.toUpperCase().indexOf("JMS") != -1 && !TestUtilities.areWeTesting("jms")) return; TestUtilities.setProviderForProtocol(protocol); try { WSIFServiceFactory factory = WSIFServiceFactory.newInstance(); WSIFService service = factory.getService( wsdlLocation, null, null, "http://soapinterop.org/", "Doc_TestPortType"); service.mapType( new javax.xml.namespace.QName( "http://soapinterop.org/", "SingleTag"), SingleTag_Type.class ); WSIFPort port = service.getPort(portName); WSIFOperation operation = port.createOperation("SingleTag"); WSIFMessage inMsg = operation.createInputMessage(); WSIFMessage outMsg = operation.createOutputMessage(); WSIFMessage faultMsg = operation.createFaultMessage(); SingleTag_Type stt = new SingleTag_Type(); inMsg.setObjectPart("SingleTag", stt); boolean ok = operation.executeRequestResponseOperation( inMsg, outMsg, faultMsg); assertTrue("operation returned false!!", ok); Object o = null; try { o = outMsg.getObjectPart("SingleTag"); assertTrue("response is null!!!", o != null); } catch (WSIFException e) { assertTrue("response part 'SingleTag' not found in output message!!!", false); } assertTrue( "response part has wrong type: " + o.getClass(), SingleTag_Type.class.isAssignableFrom(o.getClass())); } catch (Exception ex) { ex.printStackTrace(); assertTrue( "InteropDocTest.doitSingleTagDII(" + portName + ") caught exception " + ex.getLocalizedMessage(), false); } } private void doitSimpleDocumentDII(String portName, String protocol) { if (portName.toUpperCase().indexOf("JMS") != -1 && !TestUtilities.areWeTesting("jms")) return; TestUtilities.setProviderForProtocol(protocol); try { WSIFServiceFactory factory = WSIFServiceFactory.newInstance(); WSIFService service = factory.getService( wsdlLocation, null, null, "http://soapinterop.org/", "Doc_TestPortType"); service.mapType( new javax.xml.namespace.QName( "http://soapinterop.org/", "SimpleDocument"), SimpleDocument_Type.class ); WSIFPort port = service.getPort(portName); WSIFOperation operation = port.createOperation("SimpleDocument"); WSIFMessage inMsg = operation.createInputMessage(); WSIFMessage outMsg = operation.createOutputMessage(); WSIFMessage faultMsg = operation.createFaultMessage(); SimpleDocument_Type sdt = new SimpleDocument_Type(); sdt.setValue("petra"); inMsg.setObjectPart("SimpleDocument", sdt); boolean ok = operation.executeRequestResponseOperation( inMsg, outMsg, faultMsg); assertTrue("operation returned false!!", ok); Object o = null; try { o = outMsg.getObjectPart("SimpleDocument"); assertTrue("response is null!!!", o != null); } catch (WSIFException e) { assertTrue("response part 'SimpleDocument' not found in output message!!!", false); } assertTrue( "response part has wrong type: " + o.getClass(), SimpleDocument_Type.class.isAssignableFrom(o.getClass())); SimpleDocument_Type response = (SimpleDocument_Type) o; assertTrue( "document value wrong: " + response.getValue(), sdt.getValue().equals(response.getValue())); } catch (Exception ex) { ex.printStackTrace(); assertTrue( "InteropDocTest.doitSimpleDocumentDII(" + portName + ") caught exception " + ex.getLocalizedMessage(), false); } } private void doitComplexDocumentDII(String portName, String protocol) { if (portName.toUpperCase().indexOf("JMS") != -1 && !TestUtilities.areWeTesting("jms")) return; TestUtilities.setProviderForProtocol(protocol); try { WSIFServiceFactory factory = WSIFServiceFactory.newInstance(); WSIFService service = factory.getService( wsdlLocation, null, null, "http://soapinterop.org/", "Doc_TestPortType"); service.mapType( new javax.xml.namespace.QName( "http://soapinterop.org/", "ComplexDocument"), ComplexDocument_Type.class ); service.mapType( new javax.xml.namespace.QName( "http://soapinterop.org/", "ArrayOfSimpleDocument"), ArrayOfSimpleDocument.class ); service.mapType( new javax.xml.namespace.QName( "http://soapinterop.org/", "SimpleDocument"), SimpleDocument_Type.class ); service.mapType( new javax.xml.namespace.QName( "http://soapinterop.org/", "ChildDocument"), ChildDocument.class ); WSIFPort port = service.getPort(portName); WSIFOperation operation = port.createOperation("ComplexDocument"); WSIFMessage inMsg = operation.createInputMessage(); WSIFMessage outMsg = operation.createOutputMessage(); WSIFMessage faultMsg = operation.createFaultMessage(); ComplexDocument_Type cdt = makeComplexDocument(); testComplexDocument(cdt); inMsg.setObjectPart("ComplexDocument", cdt); boolean ok = operation.executeRequestResponseOperation( inMsg, outMsg, faultMsg); assertTrue("operation returned false!!", ok); Object o = null; try { o = outMsg.getObjectPart("ComplexDocument"); assertTrue("response is null!!!", o != null); } catch (WSIFException e) { assertTrue("response part 'ComplexDocument' not found in output message!!!", false); } assertTrue( "response part has wrong type: " + o.getClass(), ComplexDocument_Type.class.isAssignableFrom(o.getClass())); testComplexDocument((ComplexDocument_Type)o); } catch (Exception ex) { ex.printStackTrace(); assertTrue( "InteropDocTest.doitComplexDocumentDII(" + portName + ") caught exception " + ex.getLocalizedMessage(), false); } } private ComplexDocument_Type makeComplexDocument() { ComplexDocument_Type cdt = new ComplexDocument_Type(); ArrayOfSimpleDocument asd = new ArrayOfSimpleDocument(); SimpleDocument_Type[] adt = new SimpleDocument_Type[2]; adt[0] = new SimpleDocument_Type("petra"); adt[1] = new SimpleDocument_Type("ant"); asd.setSimpleDocument(adt); cdt.setSimpleDoc(asd); ChildDocument cd = new ChildDocument(); asd = new ArrayOfSimpleDocument(); adt = new SimpleDocument_Type[1]; adt[0] = new SimpleDocument_Type("sue"); asd.setSimpleDocument(adt); cd.setChildSimpleDoc(asd); cdt.setChild(cd); cdt.setAnAttribute("together"); return cdt; } private void testComplexDocument(ComplexDocument_Type cdt) { ArrayOfSimpleDocument asd = cdt.getSimpleDoc(); assertTrue("asd is null!!!", asd != null); SimpleDocument_Type[] adt = asd.getSimpleDocument(); boolean b = "petra".equals(adt[0]); assertTrue("adt is null!!!", adt != null); assertTrue("adt length not 2, is: " + adt.length, adt.length == 2); assertTrue("child adt[0] not 'petra', is: " + adt[0], "petra".equals(adt[0].getValue())); assertTrue("child adt[1] not 'ant', is: " + adt[0], "ant".equals(adt[1].getValue())); ChildDocument cd = cdt.getChild(); asd = cd.getChildSimpleDoc(); assertTrue("child asd is null!!!", asd != null); adt = asd.getSimpleDocument(); assertTrue("child adt is null!!!", adt != null); assertTrue("child adt length not 1, is: " + adt.length, adt.length == 1); assertTrue("child adt[0] not 'sue', is: " + adt[0], "sue".equals(adt[0].getValue())); String s = cdt.getAnAttribute(); assertTrue("attribute not 'together' is: " + s, "together".equals(s)); } private void printElement(Element e) throws Exception { OutputFormat of = new OutputFormat(e.getOwnerDocument(), "UTF-8", true); XMLSerializer xmls = new XMLSerializer(of); StringWriter sw = new StringWriter(); xmls.setOutputCharStream(sw); xmls.serialize(e); System.err.println("element=" + sw.toString()); } }