• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sending array of bytes through webservice

 
mansour polaris
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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!!!
 
Sathees sam
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic