You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Joe Ammann <jo...@pyx.ch> on 2005/07/11 15:18:42 UTC

WSDL for a SwA Webservice with SOAP headers

Hi list

I have a problem defining the WSDL for a Webservice that has the following 
characteristics.

- it has as input a sequence of strings
- the output is a sequence of binary documents which I want to have MIME 
encodede (SwA)
- it has a INOUT SOAP header (a simple string)
- it has another OUT SOAP header (a record of 2 longs)

I'm using Axis 1.1. Attached is what I've produced so far out of these 
requirements (the WSDL is slightly abbreviated, but it highlights the main 
issues). WSDL2Java generates some valid Java and deployment descriptors out 
of this, but I have 2 question regarding this.

1) When I specify the "images" part to be an MIME attachments, WSDL2Java 
generates an Java method signature with 
org.apache.axis.holders.OctetStreamHolder in it. Somewhat understandable, but 
I would like it to produce a DocumentListHolder instead. Is there a way to 
achieve this? If I specify anything else than "application/octetstream" as 
the MIME type, WSDL2Java crashes with an NPE :-(

2) When I specify the 2 parts "callid" and "timestamp" to be header elements 
in the output message, the generated wsdd does not mark them as headers. Is 
there a way to fix this?

Generally, does the attached WSDL look more or less ok. I can always manually 
fix the generated stuff and get it to work, but I thought I'd ask if there is 
a more clever way to do it :-)

CU, Joe

<?xml version="1.0" encoding="utf-8"?>

<wsdl:definitions name="XXX" 
    targetNamespace="http://xxx"
    xmlns="http://xxx"
    xmlns:tns="http://xxx"
    xmlns:types="http://xxx"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

    <xs:complexType name="DocumentReferenceList">
        <xs:sequence>
            <xs:element name="docReference" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
    
    <xs:complexType name="DocumentList">
        <xs:sequence>
            <xs:element name="document" type="xs:anyType"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="TimeStamp">
        <xs:all>
            <xs:element name="in" type="xs:long" nillable="false" />
            <xs:element name="out" type="xs:long" nillable="false" />
        </xs:all>
    </xs:complexType>

    <wsdl:message name="GetImageListRequest">
        <wsdl:part name="imageRefs" type="types:DocumentReferenceList"/>
        <wsdl:part name="callId" type="xs:string"/>
    </wsdl:message>
    
    <wsdl:message name="GetImageListResponse">
        <wsdl:part name="images" type="types:DocumentList"/>
        <wsdl:part name="callId" type="xs:string"/>
        <wsdl:part name="timeStamp" type="types:TimeStamp"/>
    </wsdl:message>

    <!-- port type declns -->
    <wsdl:portType name="GetImageList">
        <wsdl:operation name="execute">
            <wsdl:input message="GetImageListRequest"/>
            <wsdl:output message="GetImageListResponse"/>
        </wsdl:operation>
    </wsdl:portType>

    <!-- binding declns -->
    <wsdl:binding name="GetImageListBinding" type="GetImageList">
        <soap:binding style="rpc" 
            transport="http://schemas.xmlsoap.org/soap/http"/>
         <wsdl:operation name="execute">
            <soap:operation soapAction="http://xxx"/>
            <wsdl:input>
                <soap:body use="literal"/>
                <soap:header use="literal" part="callId"/>
            </wsdl:input>
            <wsdl:output>
                <mime:multipartRelated>
                    <mime:part>
                        <soap:body use="literal"/>
                        <soap:header part="callId" use="literal" />
                        <soap:header part="timeStamp" use="literal" />
                    </mime:part>
                    <mime:part>
                        <mime:content part="images"
                            type="application/octetstream"/>
                    </mime:part>
                </mime:multipartRelated>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

    <!-- service decln -->
    <wsdl:service name="GetImageListService">
        <wsdl:port name="GetImageList" binding="GetImageListBinding">
            <soap:address 
                location="http://localhost:8080/xxx/GetImageList"/>
        </wsdl:port>
    </wsdl:service>

</wsdl:definitions>