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 Ryan Bell <rb...@providerlink.com> on 2005/04/04 16:05:33 UTC

WSDL2Java for doc/literal w/ array of attachments?

Hi, I'm trying to create a wsdl that is ws-i AP 1.0 compliant for a
message that will accept some arguments including an array of
attachments.  I think I've got the wsdl correct but WSDL2Java will not
generate a stub that accepts an array of attachments (DataHandlers).  I
originally tried using Java2WSDL to generate this wsdl but it had
several issues (used a type of apachesoap:datahandler and did not use
mime in the binding) so I had to generate it by hand.  I'm using axis
1.2RC3 and the test WSDL below which generates the stub signature:

    public java.lang.String[] sendTest(java.lang.String test,
javax.activation.DataHandler xDocs) throws java.rmi.RemoteException;

what I want is:
    public java.lang.String[] sendTest(java.lang.String test,
javax.activation.DataHandler[] xDocs) throws java.rmi.RemoteException;

Can anyone tell me if I'm doing something wrong or if this is a bug with
WSDL2Java?

Here's the wsdl:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://localhost/ws/services/Test" 
  name="Test"
  xmlns:impl="http://localhost/ws/services/Test" 
  xmlns:tns1="http://impl.services.ws" 
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
  xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">

 <wsdl:types>
  <schema elementFormDefault="qualified"
targetNamespace="http://impl.services.ws"
xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="sendTest">
    <complexType>
     <sequence>
      <element name="test" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <complexType name="DocArray">
     <sequence>
      <element maxOccurs="unbounded" minOccurs="0" name="docs"
type="xsd:hexBinary"/>
	 </sequence>
   </complexType>
   <element name="sendTestResponse">
    <complexType>
     <sequence>
       <element maxOccurs="unbounded" minOccurs="0"
name="sendTestReturn" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
  </schema>
 </wsdl:types>

   <wsdl:message name="sendTestRequest">
      <wsdl:part element="tns1:sendTest" name="body"/>
      <wsdl:part type="tns1:DocArray" name="xDocs"/>
   </wsdl:message>
   <wsdl:message name="sendTestResponse">
      <wsdl:part element="tns1:sendTestResponse" name="parameters"/>
   </wsdl:message>

   <wsdl:portType name="Test">
      <wsdl:operation name="sendTest">
         <wsdl:input message="impl:sendTestRequest"
name="sendTestRequest"/>
         <wsdl:output message="impl:sendTestResponse"
name="sendTestResponse"/>
      </wsdl:operation>
   </wsdl:portType>

   <wsdl:binding name="TestSoapBinding" type="impl:Test">
      <wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="sendTest">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="sendTestRequest">
          <mime:multipartRelated>
            <mime:part>
              <wsdlsoap:body parts="body" use="literal"/>
            </mime:part>
            <mime:part>
              <mime:content part="xDocs" type="*/*"/>
            </mime:part>
          </mime:multipartRelated>
         </wsdl:input>
         <wsdl:output name="sendTestResponse">
            <wsdlsoap:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>

   <wsdl:service name="TestService">
      <wsdl:port binding="impl:TestSoapBinding" name="Test">
         <wsdlsoap:address location="http://localhost/Test"/>
      </wsdl:port>
   </wsdl:service>

</wsdl:definitions>

Thanks,
Ryan