Hi,

I have been looking at how to write a WSDL file to use Soap Message with
Attachment. I have found examples on the web using <mime:multipartRelated>,
example below:

<message name="Request">
                <part name="photo" type="xsd:hexBinary"/> </message>
<message name="Response">
                <part name="status" type="xsd:string"/> </message>

<wsdl:operation name="addPhoto">
      <wsdl:input>
        <mime:multipartRelated>
          <mime:part>
            <soap:body use="literal"/>
          </mime:part>
          <mime:part>
            <mime:content part="photo" type="image/jpeg"/>
          </mime:part>
        </mime:multipartRelated>
      </wsdl:input>

      <wsdl:output>
        <mime:multipartRelated>
          <mime:part>
            <soap:body use="literal"/>
          </mime:part>
          <mime:part>
            <mime:content part="status" type="text/plain"/>
          </mime:part>
        </mime:multipartRelated>
      </wsdl:output>
    </wsdl:operation>

NOTE: I am not sure this is how you describe parts relate to mime attachment
types, But without this, there will be NULLPointerException in symboltable.
<message name="Request">
                <part name="photo" type="xsd:hexBinary"/> </message>

This seems to describe the structure of the soap message correctly with
respect to the documentation on W3C. SoapAttachment* files uses similar
structure as well. 
I tried using this with WSDL2WS, but the generated skeleton and stub don't
use Attachments at all. It will just have a function (in this case
addPhoto), it just treats it as having input xsd:hexBinary and output
xsd:string, no attachment functions used.

I have also found the file under tests directory in the repository:
http://svn.apache.org/repos/test/webservices/axis1/trunk/c/tests/auto_build/
testcases/wsdls/Attachment1.wsdl which also uses attachments. When I try to
run WSDL2WS on it, it returns the following error: "Type
{http://xml.apache.org/xml-soap}DataHandler is referenced but not defined."
(basically for all types using http://xml.apache.org/xml-soap namespace). 

I am not sure how this works but is there suppose to be a schema defined for
the DataHandler or any other attachment type? Am I supposes to define it
myself? 

Also does WSDL2WS handle multiple Attachments as output?

Can anyone point me in the right direction? Any help is greatly appreciated.

Thanks in Advance.

Regards,
Yuan

--
Yuan Liu
[EMAIL PROTECTED]


Reply via email to