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 Romain Conseil <ro...@gmail.com> on 2007/03/01 16:33:10 UTC

Send an attachment in response with soap headers

Hello,

I'm pretty new in web services and axis...

Here is the simplified class file IDataCenter.java


package com.cnes.sitools.amda;

import java.util.Date;
import javax.activation.DataHandler ;

public interface IDataCenter {

    public  DataHandler getParameter(String mission, String instrument,
String parameter, Date startDate, Date StopDate); }


I used wsdl2java to generate this WSDL file :


<?xml version=3D"1.0" encoding=3D"UTF-8"?>
<wsdl:definitions targetNamespace=3D"urn:amda.sitools.cnes.com"
xmlns:impl=3D"urn: amda.sitools.cnes.com"
xmlns:intf=3D"urn:amda.sitools.cnes.com"
xmlns:apachesoap=3D" http://xml.apache.org/xml-soap"
xmlns:wsdlsoap=3D"http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc=3D" http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"
xmlns:wsdl=3D" http://schemas.xmlsoap.org/wsdl/">
<!--WSDL created by Apache Axis version: 1.3
Built on Oct 05, 2005 (05:23:37 EDT)-->
 <wsdl:types>
  <schema xmlns=3D" http://www.w3.org/2001/XMLSchema"
targetNamespace=3D"urn:amda.sitools.cnes.com">
   <import namespace=3D" http://xml.apache.org/xml-soap"/>
   <import namespace=3D"http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name=3D"ArrayOf_xsd_string">
    <complexContent>
     <restriction base=3D"soapenc:Array">
      <attribute ref=3D"soapenc:arrayType" = wsdl:arrayType=3D"xsd:string[]
"/>
     </restriction>
    </complexContent>
   </complexType>
  </schema>
 </wsdl:types>

   <wsdl:message name=3D"getParameterResponse">
      <wsdl:part name=3D"getParameterReturn"
type=3D"apachesoap:DataHandler"/>
   </wsdl:message>

   <wsdl:message name=3D"getParameterRequest">
      <wsdl:part name=3D"in0" type=3D"xsd:string"/>
      <wsdl:part name=3D"in1" type=3D"xsd:string"/>
      <wsdl:part name=3D"in2" type=3D"xsd:string"/>
      <wsdl:part name=3D"in3" type=3D"xsd:dateTime"/>
      <wsdl:part name=3D"in4" type=3D"xsd:dateTime"/>
   </wsdl:message>

   <wsdl:portType name=3D"IDataCenter">
      <wsdl:operation name=3D"getParameter" parameterOrder=3D"in0 in1 = in2
in3 in4">
         <wsdl:input name=3D"getParameterRequest"
message=3D"impl:getParameterRequest"/>
         <wsdl:output name=3D"getParameterResponse"
message=3D"impl:getParameterResponse"/>
      </wsdl:operation>
   </wsdl:portType>

   <wsdl:binding name=3D"IDataCenterSoapBinding" =
type=3D"impl:IDataCenter">
      <wsdlsoap:binding style=3D"rpc" transport=3D"
http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name=3D"getParameter">
         <wsdlsoap:operation soapAction=3D""/>
         <wsdl:input name=3D"getParameterRequest">
            <wsdlsoap:body use=3D"encoded"
encodingStyle=3D"http://schemas.xmlsoap.org/soap/encoding/
"
namespace=3D"urn:amda.sitools.cnes.com"/>
         </wsdl:input>
         <wsdl:output name=3D"getParameterResponse">
            <wsdlsoap:body use=3D"encoded" encodingStyle=3D"
http://schemas.xmlsoap.org/soap/encoding/"
namespace=3D"urn: amda.sitools.cnes.com"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>

   <wsdl:service name=3D"IDataCenterService">
      <wsdl:port name=3D"IDataCenter" binding=3D"impl:IDataCenterSoapBinding">

         <wsdlsoap:address location=3D"
http://127.0.0.1:8080/sitools/services/IDataCenter"/>
      </wsdl:port>
   </wsdl:service>

</wsdl:definitions>


The getParameter operation enables to extract data from a big file
(according to start and stop date) and return a smaller file with the only
usefull information.

I would like to be sure that using a DataHandler object in return enables to
create soap messages with attachment between server and client or will the
dataHandler object be serialized or something like that ?=20

On top of that I'd like to set some soap headers in the response (to qualify
the smaller file). How can I proceed ?


Thanks a lot for your help.

Romain.