I'm back, feeling just a teeny bit more learned :)
If you are indeed using 'soap with attachments' [ref:
http://www.w3.org/TR/SOAP-attachments ] then you need to create a 'soap
message package'.

A soap message package is a mime multi-part request that encapsulates the
soap xml and one ore more 'attachments'.

Getting to cfhttp... unfortunately the http request content type has to be
"Multipart/Related", so you can't use cfhttp mutipart="true".

It may work like this;

<cfhttp url="http://localhost:8300/receiver.cfm";
method="post" resolveurl="no" redirect="yes" charset="utf-8">

    <cfhttpparam type="header" name="Content-type" value='Multipart/Related;
boundary=MIME_boundary; type=text/xml; start="<
http://mrbuzzy.org/example.xml>"' />

    <cfhttpparam type="body" value="#myBody#" />

</cfhttp>

Note the 'body' of the request is binary (yeah, it seems cfhttp will allow
it).

It's going to be tricky to create the muti-part body (but maybe not
impossible), like dis...

<cfsavecontent variable="myText">
--MIME_boundary
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <http://mrbuzzy.org/example.xml>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
envelope/">
  <SOAP-ENV:Header/>
  <SOAP-ENV:Body>
     <StoreImageRequest xmlns:urn="urn:company-com-
au:service:easyimage:2007:05">
        <logicalRepository>CustomerTest</logicalRepository>
        <image>
           <urn:imageData>cid:827370646852</urn:imageData>
           <imageData>Bluehills.jpg</imageData>
        </image>
     </StoreImageRequest>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

--MIME_boundary
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-ID: <http://mrbuzzy.org/Bluehills.jpg>

</cfsavecontent>

<cffile action="write" file="#expandpath('/myTemp.dat')#" output="">
<cffile action="readbinary" file="#expandpath('/Bluehills.jpg')#"
variable="myImage">
<cffile action="append" file="#expandpath('/myTemp.dat')#"
output="#myText#">
<cffile action="append" file="#expandpath('/myTemp.dat')#"
output="#myImage#">
<cffile action="append" file="#expandpath('/myTemp.dat')#"
output="--MIME_boundary--">
<cffile action="readbinary" file="#expandpath('/myTemp.dat')#"
variable="myBody">

This is completely untested. I couldn't find a web service to try it on and
it would be a pain to debug the body format. But it might work too ;)

Cheers.

On Wed, Mar 18, 2009 at 6:58 PM, MrBuzzy <[email protected]> wrote:

> Hi Darren,
>
> Soap with attachments has been on my 'to get my head around' list for
> a while. I've done similar things but not that exactly.
>
> I assume you have tried cfinvoke and it didn't work, which is why
> you're using cfhttp?
>
> Can you look at the wsdl to work out what type of data is expected by
> the service? Perhaps you can post a snippet.
>
> (I can't recall if soap attachments expects the binary data encoded to
> a string, or if you can post the file 'raw' like you're doing)
>
> If noone else provides the answer, I'm happy to try it out myself for fun.
>
> Cheers.
>
>
> On 18/03/2009, Darren Tracey <[email protected]> wrote:
> >
> > We need to call an existing software service here from our CF8 and
> > Flex app, and we need to access it (to submit a file for storage) via
> > "SOAP with Attachments".
> > We can't see how to do this from within CF and haven't had much luck
> > with Google.
> > If you try to mix the request content types in the SOAP call, you get
> > a CF error.
> >
> > Here's the code:
> >
> -----------------------------------------------------------------------------
> > <cfxml variable="theXML">
> >  <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
> > envelope/">
> >    <SOAP-ENV:Header/>
> >    <SOAP-ENV:Body>
> >       <StoreImageRequest xmlns:urn="urn:company-com-
> > au:service:easyimage:2007:05">
> >          <logicalRepository>CustomerTest</logicalRepository>
> >          <image>
> >             <!--- <urn:imageData>cid:827370646852</urn:imageData> --->
> >
> > <imageData>Bluehills.jpg</imageData>
> >          </image>
> >       </StoreImageRequest>
> >    </SOAP-ENV:Body>
> > </SOAP-ENV:Envelope>
> > </cfxml>
> >
> > <cfhttp url="http://servername:16400/easyimage/services/
> > EasyImageService" username="username" password="password"
> > method="post" resolveurl="no" redirect="yes" charset="utf-8"> --->
> >                 <cfhttpparam type="xml" value="#theXML#" />
> >     <cfhttpparam type="file" file="Bluehills.jpg"
> > name="Bluehills.jpg" />
> > </cfhttp>
> >
> --------------------------------------------------------------------------------------------
> >
> > Here's the error:
> > You may not mix the use of cfhttpparam tags of type FILE or FORMFIELD
> > with cfhttpparam tags of type BODY or XML.
> >
> > The error occurred in E:\euc_smallapps\_test\cfml\Fred_SOAP1.cfm: line
> > 45
> > 43 : <!--- <cfhttpparam type="" type="header" name="SOAPAction" value
> > = "getProductInfoXML"> --->
> > 44 :    <cfhttpparam type="xml" value="#theXML#" />
> > 45 :     <cfhttpparam type="file" file="Bluehills.jpg"
> > name="Bluehills.jpg" />
> > 46 : </cfhttp>
> > 47 :
> >
> >
> > Has anyone ever been able to get this to work?
> > Does anyone have any suggestions?
> >
> > Regards
> > Darren Tracey
> > > >
> >
>
> --
> Sent from my mobile device
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to