• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

sending array of bytes through webservice

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

I need to send a byte array (i.e. byte[]) secret key from client to webservice to be used for encryption in both parties.

First I tried to build a method in webservice that accepts a byte [] and retrun byte [] as well but when I initiate the call from client I get this exception at client side:

javax.xml.rpc.JAXRPCException: Simple Type Mismatch
at com.sun.j2mews.xml.rpc.SOAPEncoder.encode(SOAPEncoder.java:81)
at com.sun.j2mews.xml.rpc.OperationImpl.invoke(OperationImpl.java:233)

I think because I edited the type of input/ouput parameters mannually in the stub to be Type.Byte becaue it was giving me UNKNOWN type.


Second I tried to convert byte array to string (i.e. new String(b,0,b.length) ) but when I initiate webservice call I get this exception at server side:

javax.xml.ws.soap.SOAPFaultException: Bad request
at com.sun.xml.ws.encoding.soap.SOAPDecoder.raiseFault(SOAPDecoder.java:674)
at com.sun.xml.ws.encoding.soap.server.SOAPXMLDecoder.raiseBadXMLFault(SOAPXMLDecoder.java:172)
at com.sun.xml.ws.encoding.soap.server.SOAPXMLDecoder.toInternalMessage(SOAPXMLDecoder.java:87)



please help me how to transfer a byte array as parameter to webservice and get an output of byte array to the client?

is it allowed!!!
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI polaris,

"please help me how to transfer a byte array as parameter to webservice and get an output of byte array to the client?"

you can use the parameter type as javax.activation.DataHandler instead of byte[] ?

good luck

Sathees
reply
    Bookmark Topic Watch Topic
  • New Topic