axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anne Thomas Manes <atma...@gmail.com>
Subject Re: Empty responses with Axis 1.3
Date Wed, 21 Dec 2005 22:39:40 GMT
If you want ArrayOfCodes to contain CodeImpl rather than Code, then you must
define the type that way:

<xsd:complexType name="ArrayOfCodes">
<xsd:sequence>
  <xsd:element maxOccurs="unbounded" minOccurs="0" name="code"
type="pub:CodeImpl"/>
</xsd:sequence>
</xsd:complexType>

Otherwise, if you define the inner type as Code and you return CodeImpl, the
client should generate an error that it found an unexpected type..

But that doesn't explain why your service doesn't return a SOAP envelope. I
suggets you run wsdl2java and compare the skeleton code.

Anne

On 12/21/05, Davide Romanini <d.romanini@cineca.it> wrote:
>
> Hi,
>
> I'm developing a Web Service using Axis 1.3. I've manually created the
> WSDL and all Java classes and implementation. I DON'T want to use
> wsdl2java, I already have all things right. I'm trying to setup a
> correct server-config.wsdd configuration to bind Axis to my
> implementation class.
>
> I have a simple operation list:
>
> public UID[] list();
>
> The return type has been mapped in XSchema as ArrayOfCodes
> <xsd:complexType name="ArrayOfCodes">
> <xsd:sequence>
>   <xsd:element maxOccurs="unbounded" minOccurs="0" name="code"
> type="pub:Code"/>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:complexType name="Code"/>
>
> Note that XSchema type Code is the equivalent of the Java marker
> interface UID.
>
> I then have a concret implementation of UID:
>
> public class UIDImpl implements UID, Serializable
> {
>     private String value;
>     private Date lastUpdateDate;
>     // getters and setters ...
> }
>
> XSchema:
> <xsd:complexType name="CodeImpl">
> <xsd:complexContent>
>   <xsd:extension base="pub:Code">
>    <xsd:all>
>     <xsd:element maxOccurs="1" minOccurs="1" name="value"
> type="xsd:string"/>
>     <xsd:element minOccurs="0" name="lastUpdateDate" type="xsd:dateTime"/>
>    </xsd:all>
>   </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
>
> In wsdl the operation is defined as follows:
>
> <wsdl:message name="listRequest" />
> <wsdl:message name="listResponse">
> <wsdl:part name="codes" type="pub:ArrayOfCodes" />
> </wsdl:message>
> ...
> <wsdl:operation name="list">
> <wsdl:input message="pub:listRequest" name="listRequest"/>
> <wsdl:output message="pub:listResponse"/>
> </wsdl:operation>
> ...
> <soap:binding style="rpc" transport="
> http://schemas.xmlsoap.org/soap/http"/>
> <wsdl:operation name="list">
>   <soap:operation soapAction="http://example.com/service#list"/>
>   <wsdl:input>
>    <soap:body namespace="http://example.com/service" use="literal"/>
>   </wsdl:input>
>   <wsdl:output>
>    <soap:body namespace="http://example.com/service" use="literal"/>
>   </wsdl:output>
> </wsdl:operation>
>
> I then made mappings in server-config.wsdd:
>
> <operation name="list" returnQName="pub:codes"
> returnType="pub:ArrayOfCodes" />
> <arrayMapping qname="pub:ArrayOfCodes"
> type="java:it.cineca.UID[]"
> innerType="pub:Code" />
> <typeMapping qname="pub:Code"
> type="java:it.cineca.UID"
> serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
> deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" />
> <typeMapping qname="pub:CodeImpl"
>   type="java:it.cineca.mods.CodeImpl"
>   serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
>   deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" />
>
> I created a simple client that sends the following payload:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <SOAP-ENV:Envelope  xmlns:SOAP-ENV="
> http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:ns4="http://example.com/service">
> <SOAP-ENV:Body>
>   <ns4:list/>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> I see, from my application logs, that my method is correctly invoked by
> Axis, but Axis replies to me just with HTTP/1.1 200 OK,
> without any SOAP envelope :-(
>
> I expect something like this:
> <?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>
>   <listResponse xmlns="http://example.com/service">
>    <codes xsi:type="pub:ArrayOfCodes">
>     <code xsi:type="pub:CodeImpl">
>      <value>100</value>
>      <lastUpdateDate>somedatetime</lastUpdateDate>
>     </code>
>     <code xsi:type="pub:CodeImpl">
>      <value>100</value>
>      <lastUpdateDate>anotherdatetime</lastUpdateDate>
>     </code>
>   </listResponse>
> </soapenv:Body>
> </soapenv:Envelope>
>
> What I'm wrong? I find strange that Axis doesn't return anything...
>
> Thank in advance.
>
> Bye,
> Davide Romanini
>
>

Mime
View raw message