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

Reply via email to