I need to pass a byte[] as a parameter in one of my Web Services methods as 
follows,

public SPDHMessageDTO process(SPDHMessageDTO data);
  | 
where SPDHMessageDTO is defined as follows,

public class SPDHMessageDTO {
  | 
  |     // DTO Properties
  |     private String auditReference;
  |     private byte[] spdhMessage;
  | .....
  | }
  | 

The web service deploys correctly. The wsdl file generated by wstool is as 
follows,


  | <definitions name="SPDHProtocolService" 
targetNamespace="http://com.retail_logic.ws/spdhprotocol";>
  |   <types>
  |     <schema  
targetNamespace="http://com.retail_logic.ws/spdhprotocol/types";>
  |       <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
  |          <complexType name="SPDHMessageDTO">
  |         <sequence>
  |               <element name="auditReference" type="string"/>
  |               <element name="spdhMessage" type="base64Binary"/>
  |             </sequence>
  |          </complexType>
  |      </schema>
  |   </types>
  | 

Note that the spdhMessage field is declared as "base64Binary" in the wsdl file.

The client is written in Java and the client-side stub is again generated by 
wstool. If I use stub code where the service is located as below everything 
works just fine.

private void locateService() {
  |   spdhService = (SPDHProtocolServiceWS) (new 
  |           SPDHProtocolService_Impl().getSPDHProtocolServiceWSPort());
  | }
  | 

On the other hand if I use dynamic proxy to locate the service as below I get 
type mismatch exception on the client side.

private void locateService(String wsdlURI) throws Exception {
  |   if (wsdlURI == null || wsdlURI.length() == 0) {
  |     locateService();
  |     return;
  |   }
  |   ServiceFactoryImpl sf = (ServiceFactoryImpl)   
  |                                     ServiceFactoryImpl.newInstance();
  |   URL wsdlURL = new URL(wsdlURI);
  |   QName qname = new QName(SERVICE_NAMESPACE, SERVICE_NAME);
  |   Service ots = sf.createService(wsdlURL, qname);
  |             
  |   spdhService = (SPDHProtocolServiceWS) ots.getPort(new 
  |                      QName(SERVICE_NAMESPACE, SERVICE_PORT),
  |                  SPDHProtocolServiceWS.class);
  | }           
  | 
  | 

Exception received if dynamic proxy is used:

Error: deserialization error: unexpected element type: 
expected={http://www.w3.org/2001/XMLSchema}hexBinary, 
actual={http://www.w3.org/2001/XMLSchema}base64Binary
deserialization error: unexpected element type: 
expected={http://www.w3.org/2001/XMLSchema}hexBinary, 
actual={http://www.w3.org/2001/XMLSchema}base64Binary
        at 
com.sun.xml.rpc.encoding.SOAPDeserializationContext.deserializeMultiRefObjects(SOAPDeserializationContext.java:82)
        at 
com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:163)
        at 
com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:61)
        at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:446)
        at 
com.sun.xml.rpc.client.dii.CallInvocationHandler.doCall(CallInvocationHandler.java:99)
        at 
com.sun.xml.rpc.client.dii.CallInvocationHandler.invoke(CallInvocationHandler.java:71)
        at $Proxy0.process(Unknown Source)


Would very much appreciate if anyone could explain what I need to do to use 
dynamic proxy at the client-side.

Thanks.

- Mohammad Rahin


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3858894#3858894

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3858894


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to