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: [EMAIL PROTECTED]
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
 

Reply via email to