You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Joe Desbonnet <jo...@galway.net> on 2001/12/04 17:49:33 UTC
Attachments in SOAP responses?
I presume its possible to add a (binary) attachment to a SOAP response (?).
If so how does one go about doing this with the Java Apache SOAP API? I
can't see anything obvious in the SOAPContext class to allow this.
Thanks,
Joe
Re: Attachments in SOAP responses?
Posted by "Carlos Vinueza M." <ca...@vimeworks.com>.
Chengmin Ding sent me this MS VB code that transforms Strings to ByteArrays and
viceversa, it should be useful:
'-- Convert Byte Array into a String
Public Function BytesToString(byte_array() As Byte) As String
Dim Data As String, StrLen As String
Data = StrConv(byte_array(), vbUnicode)
StrLen = InStr(Data, Chr(0)) - 1
BytesToString = Left(Data, StrLen)
End Function
'-- Convert String into a Byte Array, add trailing zeros if applicable
Public Sub StringToBytes(Data As String, ByteLen As Long, _
return_buffer() As Byte)
Dim StrLen As Long, Count As Long
Dim t As Byte
For Count = 0 To Len(Data) - 1
t = Asc(Mid(Data, Count + 1, 1))
return_buffer(Count) = t
Next Count
For Count = Len(Data) To ByteLen
return_buffer(Count) = 0
Next Count
End Sub
The code snippet to invoke the web services are:
'-- Convert input ASCII String into a Binary Array to use the MIME64
encoding
Dim aDataFeed() As Byte
Dim lLen As Long
sResult = Trim(sResult)
lLen = Len(sResult)
ReDim aDataFeed(lLen - 1)
StringToBytes sResult, lLen - 1, aDataFeed()
'-- Invoke the service
SoapClient.importVIS msUsername, msPassword, gnDataFeedID, aDataFeed
Chris Malley wrote:
> Joe Desbonnet wrote:
> >
> > I presume its possible to add a (binary) attachment to a SOAP response (?).
> > If so how does one go about doing this with the Java Apache SOAP API? I
> > can't see anything obvious in the SOAPContext class to allow this.
>
> Basic documentation is here:
> http://xml.apache.org/soap/docs/guide/attachments.html
>
> Java source for a simple example is attached. The example
> allows a client to "put" or "get" a binary file from
> a server.
>
> Has anyone done this with an MS SOAP client?
>
> -Chris
>
> --
> Chris Malley
> PixelZoom, Inc. Voice: +1.303.494.8849
> 835 Orman Drive EMail: cmalley@pixelzoom.com
> Boulder CO 80303-2616
>
> ------------------------------------------------------------------------
> Name: putget.tgz
> putget.tgz Type: Download File (application/x-compressed)
> Encoding: base64
--
Carlos Vinueza M.
Director Comercial
VIMEWorks Cia. Ltda.
Construyendo Sueños en Internet
(CEL) (593)(9)9703-375
(OFIC) (593)(2)2237-784 / (593)(2)2903-925
Re: Attachments in SOAP responses?
Posted by "Carlos Vinueza M." <ca...@vimeworks.com>.
Chengmin Ding sent me this MS VB code that transforms Strings to ByteArrays and
viceversa, it should be useful:
'-- Convert Byte Array into a String
Public Function BytesToString(byte_array() As Byte) As String
Dim Data As String, StrLen As String
Data = StrConv(byte_array(), vbUnicode)
StrLen = InStr(Data, Chr(0)) - 1
BytesToString = Left(Data, StrLen)
End Function
'-- Convert String into a Byte Array, add trailing zeros if applicable
Public Sub StringToBytes(Data As String, ByteLen As Long, _
return_buffer() As Byte)
Dim StrLen As Long, Count As Long
Dim t As Byte
For Count = 0 To Len(Data) - 1
t = Asc(Mid(Data, Count + 1, 1))
return_buffer(Count) = t
Next Count
For Count = Len(Data) To ByteLen
return_buffer(Count) = 0
Next Count
End Sub
The code snippet to invoke the web services are:
'-- Convert input ASCII String into a Binary Array to use the MIME64
encoding
Dim aDataFeed() As Byte
Dim lLen As Long
sResult = Trim(sResult)
lLen = Len(sResult)
ReDim aDataFeed(lLen - 1)
StringToBytes sResult, lLen - 1, aDataFeed()
'-- Invoke the service
SoapClient.importVIS msUsername, msPassword, gnDataFeedID, aDataFeed
Chris Malley wrote:
> Joe Desbonnet wrote:
> >
> > I presume its possible to add a (binary) attachment to a SOAP response (?).
> > If so how does one go about doing this with the Java Apache SOAP API? I
> > can't see anything obvious in the SOAPContext class to allow this.
>
> Basic documentation is here:
> http://xml.apache.org/soap/docs/guide/attachments.html
>
> Java source for a simple example is attached. The example
> allows a client to "put" or "get" a binary file from
> a server.
>
> Has anyone done this with an MS SOAP client?
>
> -Chris
>
> --
> Chris Malley
> PixelZoom, Inc. Voice: +1.303.494.8849
> 835 Orman Drive EMail: cmalley@pixelzoom.com
> Boulder CO 80303-2616
>
> ------------------------------------------------------------------------
> Name: putget.tgz
> putget.tgz Type: Download File (application/x-compressed)
> Encoding: base64
--
Carlos Vinueza M.
Director Comercial
VIMEWorks Cia. Ltda.
Construyendo Sueños en Internet
(CEL) (593)(9)9703-375
(OFIC) (593)(2)2237-784 / (593)(2)2903-925
Re: Attachments in SOAP responses?
Posted by Guido Di Maio <gu...@TILAB.COM>.
>
look at the SOAP APCHE samples (mime folder).
It' evrithing there.
> Can anyone point me to a code example that adds an attachment to the
> response?
>
--
Guido Di Maio
Telecom Italia Lab MP/T
Via Reiss Romoli, 274 - 10148 Torino (Italy)
Voice: +39 011 228 6011
Fax: +39 011 228 6299
e-mail: guido.dimaio@tilab.com
Re: Attachments in SOAP responses?
Posted by Guido Di Maio <gu...@TILAB.COM>.
>
look at the SOAP APCHE samples (mime folder).
It' evrithing there.
> Can anyone point me to a code example that adds an attachment to the
> response?
>
--
Guido Di Maio
Telecom Italia Lab MP/T
Via Reiss Romoli, 274 - 10148 Torino (Italy)
Voice: +39 011 228 6011
Fax: +39 011 228 6299
e-mail: guido.dimaio@tilab.com
Re: Attachments in SOAP responses?
Posted by Chris Malley <cm...@pixelzoom.com>.
Chris Malley wrote:
[...]
> Look at the Server.put method in the example that I attached to
> my previous response. That server method returns a binary file
> to the client, based on a client request for a specific filename.
>
> -Chris
Woops... Make that the Server.get method.
-Chris
Re: Attachments in SOAP responses?
Posted by Chris Malley <cm...@pixelzoom.com>.
Chris Malley wrote:
[...]
> Look at the Server.put method in the example that I attached to
> my previous response. That server method returns a binary file
> to the client, based on a client request for a specific filename.
>
> -Chris
Woops... Make that the Server.get method.
-Chris
Re: Attachments in SOAP responses?
Posted by Chris Malley <cm...@pixelzoom.com>.
Joe Desbonnet wrote:
>
> I've been able to add attachments to the SOAP request at the client end and
> sucessfully access that data on the server. Now I need to send a binary
> response (I'm retrieving JPEG images).
>
> I assumed that there was something I could do with the SOAPContext object to
> enable me to do this. I've tried
> "soapContext.addBodyPart(responseBodyPart);" but that does not seem to work.
>
> Maybe I'm going about this the wrong way (?) The SOAPContext object looks
> like the obvious way to manipulate and get info the the incoming request and
> outgoing reply.
>
> Can anyone point me to a code example that adds an attachment to the
> response?
>
> Thanks,
>
> Joe.
Look at the Server.put method in the example that I attached to
my previous response. That server method returns a binary file
to the client, based on a client request for a specific filename.
-Chris
Re: Attachments in SOAP responses?
Posted by Chris Malley <cm...@pixelzoom.com>.
Joe Desbonnet wrote:
>
> I've been able to add attachments to the SOAP request at the client end and
> sucessfully access that data on the server. Now I need to send a binary
> response (I'm retrieving JPEG images).
>
> I assumed that there was something I could do with the SOAPContext object to
> enable me to do this. I've tried
> "soapContext.addBodyPart(responseBodyPart);" but that does not seem to work.
>
> Maybe I'm going about this the wrong way (?) The SOAPContext object looks
> like the obvious way to manipulate and get info the the incoming request and
> outgoing reply.
>
> Can anyone point me to a code example that adds an attachment to the
> response?
>
> Thanks,
>
> Joe.
Look at the Server.put method in the example that I attached to
my previous response. That server method returns a binary file
to the client, based on a client request for a specific filename.
-Chris
Re: Attachments in SOAP responses?
Posted by Joe Desbonnet <jo...@galway.net>.
I've been able to add attachments to the SOAP request at the client end and
sucessfully access that data on the server. Now I need to send a binary
response (I'm retrieving JPEG images).
I assumed that there was something I could do with the SOAPContext object to
enable me to do this. I've tried
"soapContext.addBodyPart(responseBodyPart);" but that does not seem to work.
Maybe I'm going about this the wrong way (?) The SOAPContext object looks
like the obvious way to manipulate and get info the the incoming request and
outgoing reply.
Can anyone point me to a code example that adds an attachment to the
response?
Thanks,
Joe.
On Tue, Dec 04, 2001 at 10:21:41AM -0700, Chris Malley wrote:
> Joe Desbonnet wrote:
> >
> > I presume its possible to add a (binary) attachment to a SOAP response (?).
> > If so how does one go about doing this with the Java Apache SOAP API? I
> > can't see anything obvious in the SOAPContext class to allow this.
>
> Basic documentation is here:
> http://xml.apache.org/soap/docs/guide/attachments.html
>
> Java source for a simple example is attached. The example
> allows a client to "put" or "get" a binary file from
> a server.
>
> Has anyone done this with an MS SOAP client?
>
> -Chris
>
> --
> Chris Malley
> PixelZoom, Inc. Voice: +1.303.494.8849
> 835 Orman Drive EMail: cmalley@pixelzoom.com
> Boulder CO 80303-2616
--
Re: Attachments in SOAP responses?
Posted by Joe Desbonnet <jo...@galway.net>.
I've been able to add attachments to the SOAP request at the client end and
sucessfully access that data on the server. Now I need to send a binary
response (I'm retrieving JPEG images).
I assumed that there was something I could do with the SOAPContext object to
enable me to do this. I've tried
"soapContext.addBodyPart(responseBodyPart);" but that does not seem to work.
Maybe I'm going about this the wrong way (?) The SOAPContext object looks
like the obvious way to manipulate and get info the the incoming request and
outgoing reply.
Can anyone point me to a code example that adds an attachment to the
response?
Thanks,
Joe.
On Tue, Dec 04, 2001 at 10:21:41AM -0700, Chris Malley wrote:
> Joe Desbonnet wrote:
> >
> > I presume its possible to add a (binary) attachment to a SOAP response (?).
> > If so how does one go about doing this with the Java Apache SOAP API? I
> > can't see anything obvious in the SOAPContext class to allow this.
>
> Basic documentation is here:
> http://xml.apache.org/soap/docs/guide/attachments.html
>
> Java source for a simple example is attached. The example
> allows a client to "put" or "get" a binary file from
> a server.
>
> Has anyone done this with an MS SOAP client?
>
> -Chris
>
> --
> Chris Malley
> PixelZoom, Inc. Voice: +1.303.494.8849
> 835 Orman Drive EMail: cmalley@pixelzoom.com
> Boulder CO 80303-2616
--
Re: Attachments in SOAP responses?
Posted by Chris Malley <cm...@pixelzoom.com>.
Joe Desbonnet wrote:
>
> I presume its possible to add a (binary) attachment to a SOAP response (?).
> If so how does one go about doing this with the Java Apache SOAP API? I
> can't see anything obvious in the SOAPContext class to allow this.
Basic documentation is here:
http://xml.apache.org/soap/docs/guide/attachments.html
Java source for a simple example is attached. The example
allows a client to "put" or "get" a binary file from
a server.
Has anyone done this with an MS SOAP client?
-Chris
--
Chris Malley
PixelZoom, Inc. Voice: +1.303.494.8849
835 Orman Drive EMail: cmalley@pixelzoom.com
Boulder CO 80303-2616
Re: Attachments in SOAP responses?
Posted by Chris Malley <cm...@pixelzoom.com>.
Joe Desbonnet wrote:
>
> I presume its possible to add a (binary) attachment to a SOAP response (?).
> If so how does one go about doing this with the Java Apache SOAP API? I
> can't see anything obvious in the SOAPContext class to allow this.
Basic documentation is here:
http://xml.apache.org/soap/docs/guide/attachments.html
Java source for a simple example is attached. The example
allows a client to "put" or "get" a binary file from
a server.
Has anyone done this with an MS SOAP client?
-Chris
--
Chris Malley
PixelZoom, Inc. Voice: +1.303.494.8849
835 Orman Drive EMail: cmalley@pixelzoom.com
Boulder CO 80303-2616