chris,
 I followed the code generated by the axis to write a client for a service which returns a complex type. but I am getting the deserializer exception. I am attching the client and the wsdl file. Could you please tell me where am I going wrong?
 
Thanks
Sudhir
 
I have written a client for a soap document based service. When I try this I am getting the following exception
- Exception:
org.xml.sax.SAXException: Deserializing parameter 'GetQuoteResult':
 could not find deserializer for type http://ws.cdyne.com/:QuoteData
 
        at org.apache.axis.message.RPCHandler.onStartChild(RPCHandle
r.java:227)
        at org.apache.axis.encoding.DeserializationContextImpl.start
Element(DeserializationContextImpl.java:831)
        at org.apache.axis.message.SAX2EventRecorder.replay(SAX2Even
tRecorder.java:199)
        at org.apache.axis.message.MessageElement.publishToHandler(M
essageElement.java:589)
        at org.apache.axis.message.RPCElement.deserialize(RPCElement
.java:224)
        at org.apache.axis.message.RPCElement.getParams(RPCElement.j
ava:248)
        at org.apache.axis.client.Call.invoke(Call.java:1701)
        at org.apache.axis.client.Call.invoke(Call.java:1608)
        at org.apache.axis.client.Call.invoke(Call.java:1169)
        at GetQuote.invokeService(GetQuote.java:43)
        at GetQuote.main(GetQuote.java:50)
org.xml.sax.SAXException: Deserializing parameter 'GetQuoteResult':
 could not find deserializer for type http://ws.cdyne.com/:QuoteData
 
I have attached the wsdl file as well..
 
What could be wrong here?
I have the QuoteData class in the classpath.
 
 
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.rpc.namespace.QName;
import javax.xml.rpc.ParameterMode;
import org.apache.axis.encoding.XMLType;
import com.infolead.servicetester.client.ClientInterface;
import java.math.*;
import java.util.*;
 
 public class GetQuote implements ClientInterface{
 private Call call=null;
 private Object response;
 
 public GetQuote(){
  try {
   String endPoint=null;
   Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
   Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
   Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
   Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
   Service  service = new Service();
   call = (Call) service.createCall();
   javax.xml.rpc.namespace.QName qName;
   qName = new javax.xml.rpc.namespace.QName("http://ws.cdyne.com/", "QuoteData");
   call.registerTypeMapping(QuoteData.class, qName, beansf, beandf, true);
   endPoint = "http://ws.cdyne.com/delayedstockquote/delayedstockquote.asmx";
   call.setUseSOAPAction(true);
   call.setTargetEndpointAddress( new java.net.URL(endPoint) );
   call.setOperationStyle("wrapped");
   call.setSOAPActionURI("http://ws.cdyne.com/GetQuote");
   call.setOperationName(new javax.xml.rpc.namespace.QName("http://ws.cdyne.com/", "GetQuote"));
   call.setEncodingStyle(null);
   java.lang.String LicenseKey;
   call.addParameter("LicenseKey", new QName("http://www.w3.org/2001/XMLSchema", "java.lang.String"), java.lang.String.class, ParameterMode.IN);
   java.lang.String StockSymbol;
   call.addParameter("StockSymbol", new QName("http://www.w3.org/2001/XMLSchema", "java.lang.String"), java.lang.String.class, ParameterMode.IN);
   call.setReturnType(new QName("http://ws.cdyne.com/", "QuoteData"), QuoteData.class);
  } catch (Exception ex) {
   ex.printStackTrace();
  }
 }
 public Object invokeService(Object[] args) throws Exception{
  Object returnValue = call.invoke(args);
  return returnValue;
 }
 
public static void main(String[] args){
 try{
  GetQuote sa = new GetQuote();
  QuoteData b = (QuoteData)sa.invokeService(new Object[] {"0", "SUNW"});
  System.out.println(b);
 }catch(Exception e){
  e.printStackTrace();
 }
}
}
 
The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt.
Integrity without knowledge is weak and useless, and knowledge without integrity is dangerous and dreadful.
----- Original Message -----
Sent: Thursday, June 06, 2002 8:52 AM
Subject: RE: Retrieving data from a SOAP packet

Anna / Paul � if I read this thread correctly, you are trying to receive a complex type from the service.  

 

Wsdl2java (if you have the service wsdl) and/or a Java2WSDL->WSDL2Java round trip (if you are starting from a service bean) will generate the proper client code.

 

After you have �good client code�, you can review the proper client side deserializer classes and deployment files to determine how to code it up by hand.

 

Samples.example5 is a good place to start.  Simply extend BeanService.java with a new method returning the Order bean.  Compile/deploy the service, get the wsdl, and generate a client using wsdl2java.

 

Hope this helps,

 

/Chris

 

 

-----Original Message-----
From: Anna Chen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 06, 2002 10:57 AM
To: [EMAIL PROTECTED]
Subject: Re: Retrieving data from a SOAP packet

 

Ok, here is my actual code:

        javax.xml.rpc.namespace.QName p0QName = new javax.xml.rpc.namespace.QName("controtex.com", "code1");
        call.addParameter(p0QName, new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"), int.class,     javax.xml.rpc.ParameterMode.IN);
      
        call.setReturnType(org.apache.axis.Constants.XSD_STRING);
        call.setUseSOAPAction(true);
        call.setSOAPActionURI("controtex.com/findZipCordinates");
        call.setEncodingStyle(null);
        call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
        call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
        call.setOperationStyle("wrapped");
        call.setOperationName(new javax.xml.rpc.namespace.QName("controtex.com", "findZipCordinates"));

        RPCElement[] input = new RPCElement[1];
        RPCParam arg1 = new RPCParam("controtex.com", "code1", new Integer(code1));
        input[0] = new RPCElement("controtex.com", "findZipCordinates", new Object[]{arg1});

        Vector          elems = (Vector) call.invoke( input ); // actual invoke here.
        SOAPBodyElement elem  = null ;
        Element         e     = null ;
        try{
        elem = (SOAPBodyElement) elems.get(0);
        e    = elem.getAsDOM();

        str = XMLUtils.ElementToString(e);


        }catch(Exception ex){
          ex.printStackTrace();
        }
        return str;

The problem is you can't use call.invoke(String p0, Object[] objs) directly, if you do, Axis will use
SimpleDeser to deserialize it.
Instead, I think, you should try to use call.invoke(RPCElement[] input); and get a Vector of SOAPBodyElement objects, and convert each SOAPBodyElement to xml String, then parse the xml String as you needed.

I had the same problem as you described and this is my solution.

Anna


At 03:41 PM 6/6/2002 +0100, you wrote:

Here is the code I am using:
 
        Service  service = new Service();
        Call     call    = (Call) service.createCall();
       
        // create the endpoint URL
        String endpoint = "http://localhost:8900/Soap-Control";
       
        // set up the call information
        call.setTargetEndpointAddress( new URL(endpoint) );
        call.setOperationStyle("rpc");
       
        RPCParam a1 = new RPCParam("hostSessionID", new String("ABC12345"));
        RPCParam a2 = new RPCParam("source", new String("/localstore/Partner.eps"));
        RPCParam a2a = new RPCParam("platform", new String("WinNT"));
        RPCParam a3 = new RPCParam("sessionType", new String("viewer"));
        RPCParam a4 = new RPCParam("userID", new String("1"));
        RPCParam a5 = new RPCParam("firstName", new String("Paul"));
        RPCParam a6 = new RPCParam("lastName", new String("Johnston"));

 
        String obj = "";
       
        // actually do the call
        try {
            obj = (String) call.invoke("CreateSession2", new Object[] { a1, a2, a2a, a3, a4, a5, a6 });
        } catch(AxisFault af) {
            System.err.println("FAULT:\n" + af.getFaultString());
        }
The error occurs when we hit the try{} block. The SOAP Packet returned looks like this:

 
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
           SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
    <SOAP-ENV:Body>  
        <CreateSession2Response>   
            <sessionReference>http://test.tm-ltd.co.uk:85/digest/3431393336323033323338313933363230333234360000000000000000000000</sessionReference>   
            <launch>
                <viewer>   
                    <version>3.0</version>   
                    <URL>http://test.tm-ltd.co.uk:85/digest/3431393336323033323338313933363230333234360000000000000000000000</URL>   
                    <versionURL>http://www.rtimage.com/client-version</versionURL>
                </viewer>
            </launch>  
        </CreateSession2Response> 
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 
And I get this error:
 
     [java] - Exception:
     [java]  org.xml.sax.SAXException: SimpleDeser cannot handle structured data!
    [java] FAULT:
      [java]    at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:155)
    [java] org.xml.sax.SAXException: SimpleDeser cannot handle structured data!
     [java]     at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:831)

 
     [java]     at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:199)
     [java]     at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:589)
     [java]     at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:224)
     [java]     at org.apache.axis.message.RPCElement.getParams(RPCElement.java:248)
     [java]     at org.apache.axis.client.Call.invoke(Call.java:1701)
     [java]     at org.apache.axis.client.Call.invoke(Call.java:1608)
     [java]     at org.apache.axis.client.Call.invoke(Call.java:1634)
     [java]     at uk.co.tm.rtp.cfx_axis.processRequest(cfx_axis.java:57)
     [java]     at uk.co.tm.rtp.cfx_axis.main(cfx_axis.java:101)
     [java]

 
Basically, I have no idea why it isn't getting into Java.
 
Any more ideas?
 
Paul
 
PS Anna, I didn't really understand that code.  No comments, so I didn't see where I could put it in.  Thanks anyway.


Yiyan Chen <[EMAIL PROTECTED]>
Interactive Programmer

JGSullivan Interactive, Inc.
Tel. (312) 943-1600
Fax. (312) 943-9675

Attachment: delayedstockquote.wsdl
Description: Binary data

Reply via email to