SOAP Attachment RRS feed

  • Question

  • User1661160222 posted

    I'm trying to figure out how to get a SOAP attachment from an existing webservice.

    This webservice has a function "GetAttachment" and the function does not return anything (does this mean that the method puts the data in a stream somewhere or something?). The people who made the webservice sent along java code as to how to get the actual attachment but no .NET code. Can anybody point me in the right direction?

    I'm working on framework 4.0 and on a website.



    Tuesday, June 11, 2013 10:58 AM

All replies

  • User-1662538993 posted

    Check this links-



    If this is not you looking for then you can post your web service code or atleast wsdl file or java code here then somebody would be able to help.

    Tuesday, June 11, 2013 5:31 PM
  • User1661160222 posted

    Thanks for your reply. The links don't really seem to help. I've already come across them in my search before.

    The java code they gave as an example:

    The GetThumbnail method is the method I'm trying to get the data from. They use getAttachments but this is a java framework method. 

            Object[] attchments = apiService.getAttachments();
            for (int i = 0; i < attchments.length; i++) {
                Object attchment = attchments[i];
                AttachmentPart firstImage = (AttachmentPart) attchment;
                byte[] imageData = new byte[4096];
                System.out.println("saving attachment "+i+" : ");


    The WSDL has the following tags concerning the method:

      <wsdl:message name="getThumbnailRequest">
        <wsdl:part name="assetId" type="xsd:long" />
    <wsdl:message name="getThumbnailResponse" />
        <wsdl:operation name="getThumbnail" parameterOrder="assetId">
          <wsdl:input name="getThumbnailRequest" message="impl:getThumbnailRequest" />
          <wsdl:output name="getThumbnailResponse" message="impl:getThumbnailResponse" />
        <wsdl:operation name="getThumbnail">
          <wsdlsoap:operation soapAction="" />
          <wsdl:input name="getThumbnailRequest">
            <wsdlsoap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
          <wsdl:output name="getThumbnailResponse">
            <wsdlsoap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />





    Wednesday, June 12, 2013 6:01 AM
  • User1661160222 posted

    A small update: I've managed to get an error with jpg data in. I'm a little bit closer already :)

    The error is the following:

    Client found response content type of 'multipart/related; type="text/xml"; start="<16CB61A81551AC09F25B8462F6E1DB1C>"; boundary="----=_Part_23_33134523.1371042764134"', but expected 'text/xml'. The request failed with the error message: -- ------=_Part_23_33134523.1371042764134 Content-Type: text/xml; charset=UTF-8 Content-Transfer-Encoding: binary Content-Id: <16CB61A81551AC09F25B8462F6E1DB1C> <?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/></soapenv:Envelope> ------=_Part_23_33134523.1371042764134 Content-Type: image/jpeg Content-Transfer-Encoding: binary Content-Id: <18E2F6C39206DDBFF8B0A4C646BFCEA1> [...] ------=_Part_23_33134523.1371042764134-- --.

    Wednesday, June 12, 2013 9:18 AM