Hi All,

I'm having trouble getting the WSDD stanzas correct to send
an ARRAY of DataHandlers (DataHandler[]) to an Axis service.

I have been successfully using the SAAJ (SOAPConnection) API
to send/receive SINGLE attachments as DataHandlers for some
time now. (working WSDD shown below)

I create a SOAPConnectionn, SOAPMessage, etc., populate
the SOAPMessage, and call

   soapConnection.call(soapMessage, mEndPointURLString);

The service method signature is:

public DataHandler convert(DataHandler dh,
                          String host,
                          String port,
                          String user )
                          throws IOException {

This all works fine to send a SINGLE attachment parameter,
with the wsdd line of:

   <parameter name="dh" type="ns1:DataHandler"/> (highlighted below)

for the DataHandler parameter.

The only relevant difference (besides different method and parameter names)
with my new client/service is that I'm packing 6 attachments into the
request msg instead of 1. The other parameters are still just Strings.

For this one, the service signature takes an array of DataHandlers:

public DataHandler submit(DataHandler[] dh,
                          String host,
                          String port,
                          String user )
                          throws IOException {

I see various WSDD examples on the internet for array types, some
with special <typeMapping> stanzas for the array
(eg. ArrayOfString)

Obviously I'm missing something here re: SOAP array handling
for special types such as DataHandler[].

Can someone take a look at the wsdd at the end of this email and
tell me if you see something obviously wrong and how to fix it?

Any help would be appreciated.
Thanks! Bill

----------------------------------------------------------
Working single-attachment wsdd file:
------------------------------------

<deployment xmlns="http://xml.apache.org/axis/wsdd/";
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";
xmlns:ns1="urn:OpenBabelConverter" >
  <service name="urn:OpenBabelConverter" provider="java:RPC">
    <requestFlow>
      <handler type="soapmonitor"/>
    </requestFlow>
    <responseFlow>
      <handler type="soapmonitor"/>
    </responseFlow>
    <parameter name="className" value="OpenBabelConverter"/>
    <parameter name="allowedMethods" value="convert"/>

    <operation name="convert" returnQName="returnqname"
returnType="ns1:DataHandler">
        <parameter name="dh" type="ns1:DataHandler"/>
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        <parameter name="inputType" type="xsd:string"/>
        <parameter name="outputType" type="xsd:string"/>
        <parameter name="optionalInfo" type="xsd:string"/>
    </operation>

    <typeMapping
      qname="ns1:String"
      languageSpecificType="java:java.lang.String"
      serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory"
      deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
    />

    <typeMapping
      qname="ns1:DataHandler"
      languageSpecificType="java:javax.activation.DataHandler"
      serializer="org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory"

deserializer="org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
    />

  </service>

</deployment>
----------------------------------------------------------
Working single-attachment request msg:
--------------------------------------

<?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>
<convert xmlns="">
<source href="cid:820536EEF82AD266E196CAAC90582347"/>
<inputType>mol2</inputType>
<outputType>pov</outputType>
<optionalInfo>d x2</optionalInfo>
</convert>
</soapenv:Body>
</soapenv:Envelope>

----------------------------------------------------------
And the working single-attachment response msg:
-----------------------------------------------

<?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>
  <convertResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
   <returnqname href="cid:4DCBA1D13196BD1A92746826534370F9";
xmlns:ns1="urn:OpenBabelConverter"/>
  </convertResponse>
 </soapenv:Body>
</soapenv:Envelope>

---------------------------------------------------------
NON-working multiple-attachment request msg: (from SOAPMonitor)
--------------------------------------------

<?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>
  <submit xmlns="">
   <source href="cid:753AD2AD7AF12659A4EF712062409F9A"/>
   <source href="cid:E37E6B289947DB4EA29C34176964D48C"/>
   <source href="cid:EE2E038F7FBCD68A106D26FC670BDA2C"/>
   <source href="cid:5B74D00F60FA13E92E2BA55423BC3B41"/>
   <source href="cid:A96144BC5BC1E8442E41D0A8C3D270AD"/>
   <source href="cid:EB87CD4C903AE21C29707966FDEDA9D5"/>
   <host>localhost</host>
   <port>8080</port>
   <user>wbarber</user>
  </submit>
 </soapenv:Body>
</soapenv:Envelope>

---------------------------------------------------------
No response msg sent...
-----------------------

---------------------------------------------------------
NON-working multiple-attachment wsdd file:
--------------------------------------------
<deployment xmlns="http://xml.apache.org/axis/wsdd/";
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";
xmlns:ns1="urn:RIOTConverter" >
  <service name="urn:RIOTConverter" provider="java:RPC">
    <requestFlow>
      <handler type="soapmonitor"/>
    </requestFlow>
    <responseFlow>
      <handler type="soapmonitor"/>
    </responseFlow>

    <parameter name="className" value="RIOTConverter"/>
    <parameter name="allowedMethods" value="submit"/>

    <operation name="submit" returnQName="returnqname"
returnType="ns1:DataHandler">
      <parameter name="dh" type="ns1:ArrayOfDataHandler"/>
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      <parameter name="host" type="xsd:string"/>
      <parameter name="port" type="xsd:string"/>
      <parameter name="user" type="xsd:string"/>
    </operation>

    <typeMapping
      xmlns:ns1="http://soapinterop.org/xsd";
      qname="ns1:ArrayOfDataHandler"
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      type="java:javax.activation.DataHandler[]"
      serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
      deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
    />

    <typeMapping
      qname="ns1:String"
      languageSpecificType="java:java.lang.String"
      serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory"
      deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
    />

    <typeMapping
      qname="ns1:DataHandler"
      languageSpecificType="java:javax.activation.DataHandler"
      serializer="org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory"

deserializer="org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
    />

  </service>

</deployment>

Bill Barber
Scientific Software Group (CCN-12)
Los Alamos National Laboratory
505-667-8616

Reply via email to