<deployment
xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<!-- Services from IArrayService WSDL service -->
<service name="ArrayService" provider="java:RPC" style="wrapped"
use="literal">
<parameter name="wsdlTargetNamespace" value="http://service"/>
<parameter name="wsdlServiceElement" value="IArrayService"/>
<parameter name="schemaQualified" value="http://service"/>
<parameter name="wsdlServicePort" value="ArrayService"/>
<parameter name="className"
value="service.ArrayServiceSoapBindingSkeleton"/>
<parameter name="wsdlPortType" value="IArray"/>
<parameter name="typeMappingVersion" value="1.2"/>
<parameter name="allowedMethods" value="*"/>
<typeMapping
xmlns:ns="http://service"
qname="ns:ComplexType"
type="java:service.ComplexType"
serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
encodingStyle=""
/>
</service>
</deployment>
This wsdd was automatically created by axis. I user the following ant build
file:
<project name="axis" default="all" basedir=".">
<property name="axis.home" value="C:\Program
Files\apache-tomcat-5.5.25\webapps\axis"/>
<property name="array-service-wsdl" value="ArrayService.wsdl"/>
<path id="axis.classpath">
<fileset dir="${axis.home}/WEB-INF/lib">
<include name="**/*.jar" />
</fileset>
</path>
<taskdef resource="axis-tasks.properties" classpathref="axis.classpath"
/>
<!-- =================================
target: all
================================= -->
<target name="all"
depends="clean,init,java2wsdl,wsdl2java,patch,compile,deploy"
description="All">
</target>
<target name="init" description="Prepare infrastructure for building">
<mkdir dir="bin" />
</target>
<target name="java2wsdl" description="Create WSDL">
<javac srcdir="src" destdir="bin" includes="service/IArray.java"
debug="on" source="1.6" />
<axis-java2wsdl
output="bin\${array-service-wsdl}"
location="http://localhost:8080/axis/services/ArrayService"
namespace="http://service"
methods="method"
style="WRAPPED"
classname="service.IArray">
<classpath>
<pathelement path="bin"/>
</classpath>
</axis-java2wsdl>
</target>
<target name="wsdl2java" description="Generate source files">
<axis-wsdl2java
verbose="true"
serverside="true"
skeletondeploy="true"
all="true"
output="bin"
testcase="false"
url="bin\${array-service-wsdl}" >
<mapping
namespace="http://service"
package="service" />
</axis-wsdl2java>
</target>
<!-- =================================
target: patch
================================= -->
<target name="patch" description="Patching source files">
<copy file="src/service/ArrayService.java"
tofile="bin/service/ArrayServiceSoapBindingImpl.java" overwrite="true"
verbose="true"/>
<replace file="bin/service/ArrayServiceSoapBindingImpl.java"
token="ArrayService" value="ArrayServiceSoapBindingImpl" />
<copy todir="bin">
<fileset dir="src">
<include name="**/*.java" />
</fileset>
</copy>
</target>
<target name="compile" description="Compile everything">
<javac srcdir="bin" destdir="bin" debug="on" source="1.6"
classpathref="axis.classpath"/>
</target>
<target name="deploy" depends="undeploy" description="Deploy
everything">
<copy todir="${axis.home}\WEB-INF\classes\service">
<fileset dir="bin\service">
<include name="**/*.class" />
</fileset>
</copy>
<axis-admin
hostname="localhost"
port="8080"
servletpath="axis/services/AdminService"
xmlfile="bin\service\deploy.wsdd">
</axis-admin>
</target>
<target name="undeploy" description="Undeploy everything">
<axis-admin
hostname="localhost"
port="8080"
servletpath="axis/services/AdminService"
xmlfile="bin\service\undeploy.wsdd">
</axis-admin>
<delete dir="${axis.home}\WEB-INF\classes\service"/>
</target>
<target name="clean" description="Clean everything">
<delete dir="bin"/>
</target>
</project>
Anne Thomas Manes wrote:
>
> Please provide your WSDD.
>
> Anne
>
> On Dec 27, 2007 8:02 AM, Sergey Bykov <[EMAIL PROTECTED]> wrote:
>>
>> I built a very simple test service the main goal is to return my custom
>> bean
>> as a result in wrapped/literal style.
>> This is service:
>> IArray.java
>>
>> package service;
>>
>> public interface IArray {
>> public ComplexType method();
>> }
>>
>> ArrayService.java
>>
>> package service;
>>
>> public class ArrayService implements IArray{
>> public ComplexType method(){
>> ComplexType complexType = new ComplexType();
>> complexType.setProp1("value21");
>> complexType.setProp2("value22");
>> return complexType;
>> }
>> }
>>
>> This is complex type definition:
>> ComplexType.java
>>
>> package service;
>>
>> public class ComplexType {
>> private String prop1;
>> private String prop2;
>>
>> public String getProp1() {
>> return prop1;
>> }
>>
>> public void setProp1(String prop1) {
>> this.prop1 = prop1;
>> }
>>
>> public String getProp2() {
>> return prop2;
>> }
>>
>> public void setProp2(String prop2) {
>> this.prop2 = prop2;
>> }
>> }
>> WSDL on the server:
>>
>> <?xml version="1.0" encoding="UTF-8" ?>
>> - <wsdl:definitions targetNamespace="http://service"
>> xmlns:apachesoap="http://xml.apache.org/xml-soap"
>> xmlns:impl="http://service" xmlns:intf="http://service"
>> 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.4
>> Built on Apr 22, 2006 (06:55:48 PDT)
>>
>> -->
>> - <wsdl:types>
>> - <schema elementFormDefault="qualified" targetNamespace="http://service"
>> xmlns="http://www.w3.org/2001/XMLSchema">
>> - <element name="method">
>> <complexType />
>> </element>
>> - <element name="methodResponse">
>> - <complexType>
>> - <sequence>
>> <element name="methodReturn" type="impl:ComplexType" />
>> </sequence>
>> </complexType>
>> </element>
>> - <complexType name="ComplexType">
>> - <sequence>
>> <element name="prop1" nillable="true" type="xsd:string" />
>> <element name="prop2" nillable="true" type="xsd:string" />
>> </sequence>
>> </complexType>
>> </schema>
>> </wsdl:types>
>> - <wsdl:message name="methodRequest">
>> <wsdl:part element="impl:method" name="parameters" />
>> </wsdl:message>
>> - <wsdl:message name="methodResponse">
>> <wsdl:part element="impl:methodResponse" name="parameters" />
>> </wsdl:message>
>> - <wsdl:portType name="IArray">
>> - <wsdl:operation name="method">
>> <wsdl:input message="impl:methodRequest" name="methodRequest" />
>> <wsdl:output message="impl:methodResponse" name="methodResponse" />
>> </wsdl:operation>
>> </wsdl:portType>
>> - <wsdl:binding name="ArrayServiceSoapBinding" type="impl:IArray">
>> <wsdlsoap:binding style="document"
>> transport="http://schemas.xmlsoap.org/soap/http" />
>> - <wsdl:operation name="method">
>> <wsdlsoap:operation soapAction="" />
>> - <wsdl:input name="methodRequest">
>> <wsdlsoap:body use="literal" />
>> </wsdl:input>
>> - <wsdl:output name="methodResponse">
>> <wsdlsoap:body use="literal" />
>> </wsdl:output>
>> </wsdl:operation>
>> </wsdl:binding>
>> - <wsdl:service name="IArrayService">
>> - <wsdl:port binding="impl:ArrayServiceSoapBinding" name="ArrayService">
>> <wsdlsoap:address
>> location="http://localhost:8080/axis/services/ArrayService" />
>> </wsdl:port>
>> </wsdl:service>
>> </wsdl:definitions>
>> And here is client:
>> Client.java
>>
>> package client;
>>
>> import org.apache.axis.client.Call;
>> import org.apache.axis.client.Service;
>> import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
>> import org.apache.axis.encoding.ser.ArraySerializerFactory;
>> import service.ComplexType;
>>
>> import javax.xml.namespace.QName;
>> import java.util.ArrayList;
>>
>> public class Client {
>>
>> public static void main(String[] args){
>> try {
>> Service service = new Service();
>> Call call = (Call) service.createCall();
>>
>> call.setTargetEndpointAddress("http://localhost:8080/axis/services/ArrayService");
>> call.setOperationName("method");
>> QName complexTypeQName = new
>> QName("http://service","ComplexType");
>> call.registerTypeMapping(ComplexType.class,
>> complexTypeQName,
>> new
>> org.apache.axis.encoding.ser.BeanSerializerFactory
>> (ComplexType.class,complexTypeQName),
>> new
>> org.apache.axis.encoding.ser.BeanDeserializerFactory(ComplexType.class,complexTypeQName));
>> call.setOperationStyle("wrapped");
>> call.setOperationUse("literal");
>> call.setReturnType(complexTypeQName, ComplexType.class);
>> ComplexType complexType = (ComplexType) call.invoke(new
>> Object[0]);
>> }
>> catch (Exception e) {
>> e.printStackTrace();
>> }
>>
>> }
>> }
>>
>> This service is extreamly simple, but I got the following problem: axis
>> client can't parse result correctly. I get the following SOAP response:
>> <?xml version="1.0" encoding="UTF-8"?>
>> <soapenv:Envelope
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> <soapenv:Body>
>> <methodResponse xmlns="">
>> <ns1:methodReturn xmlns:ns1="http://service">
>> <ns1:prop1>value21</ns1:prop1>
>> <ns1:prop2>value22</ns1:prop2>
>> </ns1:methodReturn>
>> </methodResponse>
>> </soapenv:Body>
>> </soapenv:Envelope>
>> and during parsing this complex type axis throws exeption:
>> org.xml.sax.SAXException: Deserializing parameter 'methodReturn': could
>> not
>> find deserializer for type {http://service}ComplexType
>> at
>> org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277)
>> at
>> org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
>> at
>> org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
>> at
>> org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
>> at
>> org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
>> at
>> org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
>> at org.apache.axis.client.Call.invoke(Call.java:2467)
>> at org.apache.axis.client.Call.invoke(Call.java:2366)
>> at org.apache.axis.client.Call.invoke(Call.java:1812)
>> at client.Client.main(Client.java:34)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at
>> com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
>>
>> What is missed in this simple scenario? (Also, if I change the style to
>> rpc
>> everything becomes working)
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Return-complex-type-in-wrapped-literal-style.-tp14512578p14512578.html
>> Sent from the Axis - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Return-complex-type-in-wrapped-literal-style.-tp14512578p14513008.html
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]