axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Parul.Jo...@Expeditors.com
Subject Re: No serializer found for class
Date Mon, 23 Feb 2004 18:57:29 GMT
In the response object I have an array of a complex object type. I have 
registered a serializer and de-serializers for this type of object, 
however nothing about the array. Should I have to register or specify in 
some way that the returned object consists of an array of another type of 
object?

Thanks,
Parul




Tony Blair <hrh747@yahoo.com>
02/21/2004 11:05 AM
Please respond to axis-user

 
        To:     axis-user@ws.apache.org
        cc:     (bcc: Parul Joshi/IS/Expeditors)
        Subject:        Re: No serializer found for class


Hi,
 
Below are my comments in blue:
 
Cheers..,
Tony.

Parul.Joshi@Expeditors.com wrote:

Tony, 

If I do modify the wsdd, I will have to redeploy the service again 
correct? I'm not sure if I have access to do that (since its another team 
maintaning it) <That is true. Perhaps you could do some testing on your local machine to

iron out the wrinkles before getting the other team invovled. I suggest to 
write a simple service that spoofs the behavior of your production 
service. By that I mean make the service to receive some complex type from 
the input and then return them to the caller. Play around with the WSDD 
and the Client code till you resolve all the issues.>

Also, The problem that I am facing is with the de-serializing part of it. 
Please correct me if I am wrong, but the call.addParameter() is used for 
the outgoing request, which in this case seems to work since I do get a 
valid response, I can see the response in TCPMON. <If you see a correct response in TCPMON
then it should be fine>
I've seen several examples that used this method of adding parameters to 
the call object. I tried changing it, to use the QName as the second param 
and it didn't like it. 

Another question, below is my response, so do I need to register a 
serializer for <SOAP-ENV> tag?. <Not sure ... I doubt it>
I have registered deserializers for outMsg, headers, OC315SearchRequest, 
answer, OC315SearchView, userError and systemErrors. <for each of these types and their
inner complex types (if there are any) 
you need to register the ser and deser. For example I pass an Order object 
as an input to a service operation and receive a Confirmation object. 
Order contains ShippingInfo and LineItems objects so I have to register 
all four objects>  Can you think of anything else that I need to register. Also I think
there 
might be an issues with the QName, can you help me figure out, which QName 
should I register these with. 
<Each complex type has its own QName. In the above example I would have 
four QNames>
I'm really sorry for bothering you, but I don't have too many people 
around me who can help :-(  <It's no problem be glad if I can help. Here I attached a working
example 
of a client and a WSDD to make thing more clear.>
HTTP/1.0 200 Ok 
Content-Type: text/xml 
Connection: close 
<SOAP-ENV:Envelope 
         xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
         xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
        <SOAP-ENV:Body> 
                <esi:executeRequestOut 
xmlns:esi="urn:ExpoServiceInterface"> 
                        <outMsg> 
                                <headers> 
 <requestFinishedTime></requestFinishedTime> 
 <requestReceivedTime>2004-02-19-14.47.18.000000</requestReceivedTime> 
                                        <sessionID></sessionID> 
 <processID>chq-expovatest1_9347110</processID> 
                                        <requests xsi:type="Array" 
arrayType="SearchRequest[1]"> 
                                                <SearchRequest> 
 <bookingNumber></bookingNumber> 
 <consolNumber>HKG8154229</consolNumber> 
 <containerNumber></containerNumber> 
 <masterNumber></masterNumber> 
                                                </SearchRequest> 
                                        </requests> 
                                        <columnHeadings xsi:type="Array" 
arrayType="UndefinedObject[]"> 
                                        </columnHeadings> 
                                </headers> 
                                <answer> 
                                        <isSuccessful>true</isSuccessful> 
                                        <resultsSize>3</resultsSize> 
                                        <results xsi:type="Array" 
arrayType="OC315SearchView[2]"> 
                                                <OC315SearchView> 
 <containerCtlRef>C910487788</containerCtlRef> 
 <containerNo>APLS2939750</containerNo> 
 <moveType>CY/CY</moveType> 
 <containerSeal>2680993   </containerSeal> 
 <containerSize>20</containerSize> 
 <bookingNum>DUI031281394-2</bookingNum> 
                                                </OC315SearchView> 
                                                <OC315SearchView> 
 <containerCtlRef>C910487800</containerCtlRef> 
 <containerNo>GUTU4187106</containerNo> 
 <moveType>CY/CY</moveType> 
 <containerSeal>2681968   </containerSeal> 
 <containerSize>20</containerSize> 
 <bookingNum>DUI031281904-4</bookingNum> 
                                                </OC315SearchView> 
                                        </results> 
                                        <userErrorsSize>0</userErrorsSize> 
                                        <userErrors></userErrors> 
 <systemErrorsSize>0</systemErrorsSize> 
                                        <systemErrors></systemErrors> 
                                </answer> 
                        </outMsg> 
                </esi:executeRequestOut> 
        </SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 

Thanks,
Parul 




Tony Blair <hrh747@yahoo.com> 
02/20/2004 01:20 PM 
Please respond to axis-user 
        
        To:        axis-user@ws.apache.org 
        cc:        (bcc: Parul Joshi/IS/Expeditors) 
        Subject:        Re: No serializer found for class



Parul, 
 
I've notice two things: 
 
1-Your WSDD does not have any information regarding the encoding, ser and 
deser. Perhaps you may have to add them manually yourself. The absence of 
these information results in exceptions such as Seriliazer or Desr not 
found. 
 
2-In the client code the call.addParameter() requires an Object of type 
QName according as the 2nd parameter according to the API docs, yet you 
are passing a XDS type. 
 
Other than these two I don't see anything obvious that might cause the 
exception. 
 
Regards, 
Tony.

Parul.Joshi@Expeditors.com wrote: 

The service is implemented in SmallTalk, and basically has a single main 
method "executeRequest" which takes in a generic Object, and based on the 
type of Object it returns appropriate "View" objects. 
The wsdd is below, its very different from what I've see, which is why I 
can't understand a lot of it :-( 

I've attached a soft copy, but also cut and paste the relevant sections.. 

 <?xml version="1.0" ?> 
- <!--  edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) --> 
- <!--   Generated by VisualAge Smalltalk Web Services on 6/10/2003 at 1:08:16 PM 
 --> 
- <vastwsd:deployment targetNamespace="urn:ExpoServiceInterface" 
xmlns:vast="Smalltalk" xmlns:vastwsd="urn:VASTWebServiceDeployment600" 
xmlns:esi="urn:ExpoServiceInterface" xmlns:n="urn:VASTWebServiceDeployment600" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:VASTWebServiceDeployment600">

- <services> 
               <service name="ExpoServiceInterface" namespace="http://www.ExpoServiceInterface.com/ExpoServiceInterface">

         <documentation xmlns:zmls="http://www.w3.org/2001/XMLSchema" /> 
         <serviceInterfaceClass>SstWSService</serviceInterfaceClass> 
- <provider type="SmalltalkProvider"> 
 <vast:provider className="ExpoServiceInterface" creationMethod="current" /> 
- <operations> 
 <operation name="about" qName="esi:about" /> 
 <operation name="status" qName="esi:status" /> 
 <operation name="executeRequest:" qName="esi:executeRequest" /> 
 <operation name="argsForRequestNamed:" qName="esi:argsForRequestNamed" /> 
 </operations> 
  </provider> 
<extensions /> 
 </service> 
 </services> 

This is the exectueRequest() from my client code 

private Object runExecuteRequest(Object request) throws RemoteException, AxisFault, SOAPException

  { 
       service = new Service(); 
       call    = (Call) service.createCall(); 
       call.setTargetEndpointAddress( new java.net.URL(endpoint) ); 
       call.setOperation(method2); 
       call.setOperationName(new QName("urn:ExpoServiceInterface", "executeRequest")); 
 
       setupQNames(); 
       call.addParameter( "outMsg", XMLType.XSD_ANYTYPE, ParameterMode.IN ); 
       call.setReturnClass(EIResponse.class);                         
       EIResponse obj = (EIResponse) call.invoke(new Object[] {request});                

       return obj; 
 } 

private void setupQNames() 
{ 
       java.lang.Class beanSF = BeanSerializerFactory.class; 
       java.lang.Class beanDF = BeanDeserializerFactory.class; 
       String nameSpace = "";//http://www.ExpoServiceInterface.com/ExpoServiceInterface-Interface";

 
       QName qName = new javax.xml.namespace.QName("OC315SearchRequest", "OC315SearchRequest");
                
       call.registerTypeMapping(OC315SearchRequest.class, qName, beanSF, beanDF); 
 
       qName = new javax.xml.namespace.QName(nameSpace, "OC315SearchRequest");           
     
       call.registerTypeMapping(OC315SearchRequest.class, qName, beanSF, beanDF); 
 
       qName = new javax.xml.namespace.QName(nameSpace, "OC315SearchView"); 
        call.registerTypeMapping(OC315SearchView.class, qName, beanSF, beanDF); 
 
       qName = new javax.xml.namespace.QName("EIResponse", "EIResponse"); 
       call.registerTypeMapping(EIResponse.class, qName, beanSF, beanDF); 
 
       qName = new javax.xml.namespace.QName(nameSpace, "outMsg"); 
       call.registerTypeMapping(EIResponse.class, qName, beanSF, beanDF); 
 
       qName = new javax.xml.namespace.QName(nameSpace, "EIAbstractHeader"); 
       call.registerTypeMapping(EIAbstractHeader.class, qName, beanSF, beanDF); 

       qName = new javax.xml.namespace.QName(nameSpace, "userErrors"); 
       call.registerTypeMapping(UserErrorResult.class, qName, beanSF, beanDF); 

       qName = new javax.xml.namespace.QName(nameSpace, "systemErrors"); 
       call.registerTypeMapping(SystemErrorResult.class, qName, beanSF, beanDF); 
 
       qName = new javax.xml.namespace.QName(nameSpace, "results"); 
       call.registerTypeMapping(Result.class, qName, beanSF, beanDF); 
 
       qName = new javax.xml.namespace.QName(nameSpace, "userErrors"); 
       call.registerTypeMapping(UserErrorResult.class, qName, beanSF, beanDF); 
 
       qName = new javax.xml.namespace.QName(nameSpace, "headers"); 
       call.registerTypeMapping(EIResponseHeader.class, qName, beanSF, beanDF); 
 
       qName = new javax.xml.namespace.QName(nameSpace, "errorResult"); 
       call.registerTypeMapping(ErrorResult.class, qName, beanSF, beanDF); 

       qName = new javax.xml.namespace.QName(nameSpace, "answer"); 
       call.registerTypeMapping(Answer.class, qName, beanSF, beanDF);                    
    
       qName = new javax.xml.namespace.QName(nameSpace, "systemErrors"); 
        call.registerTypeMapping(SystemErrorResult.class, qName, beanSF, beanDF); 
} 

Thanks a lot for trying to help...
Parul 


Tony Blair <hrh747@yahoo.com> 
02/20/2004 10:43 AM 
Please respond to axis-user 
        
       To:        axis-user@ws.apache.org 
       cc:        (bcc: Parul Joshi/IS/Expeditors) 
       Subject:        Re: No serializer found for class




Parul, 
 
Can you post your Client code and the your WSDD (NOT the WSDL) here? 
 
Regards, 
Tony.

Parul.Joshi@Expeditors.com wrote: 

Hi there, 
I am extremely new to Axis and SOAP, and am trying to solve this for the 
past 2 days, without and luck. 

I am running into a problem when I am trying to deserialize incoming data. 
I get the following exception. 
SimpleDeserializer encountered a child element, which is NOT expected, in 
something it was trying to deserialize. 
      at 
org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.j 

I read thru' many of the posts, and I have registered all my sub-classes 
with BeanSerializers and De-serializer. I still get this exception. 
My return type is a complex type which has 2 other complex types in it. 

I have registered outMsg, header, answer, SearchView, SearchRequest, 
userErrors, systemErrors.  Basically I have registered all the complex 
types that I expect in the return object. 
I am registering it like this. nameSpace is ="", since there isn't one 
defined in the wdss. 
       qName = new javax.xml.namespace.QName(nameSpace, "outMsg"); 
      call.registerTypeMapping(EIResponse.class, qName, beanSF, beanDF); 

I don't know if I'm registering it incorrect, since I'm not sure what I 
should put in the namespace, I tried several different things but none 
work. 

Any Help will be greatly appreciated. 


Thanks,
Parul 
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.package apacheaxis;

import org.apache.axis.AxisFault;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.utils.Options;

import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import java.util.*;
 
public class Client
{
    public static void main(String [] args) throws Exception
    {
        Options options = new Options(args);
 
        Request req = new Request(); //here is the complex object
 
        Param busLocId = new Param(); //here is the 1st bean
 
        busLocId.setName("BUSINESS_LOCATION_ID");
        busLocId.setValue("100889567");


        ArrayList inparams = new ArrayList(3); //here is the array list

        inparams.add(busLocId);

        req.setParams(inparams); //stuff the array list inside of a 
Complex object
 
        Service  service = new Service();
        Call     call    = (Call) service.createCall();

        QName qn      = new QName( "urn:PublicService4", "Request" );
        call.registerTypeMapping(Request.class, qn,
                      new 
org.apache.axis.encoding.ser.BeanSerializerFactory(Request.class, qn),  
                      new 
org.apache.axis.encoding.ser.BeanDeserializerFactory(Request.class, qn));

        QName qn1      = new QName( "urn:PublicService4", "Response" );
        call.registerTypeMapping(Response.class, qn1,
                      new 
org.apache.axis.encoding.ser.BeanSerializerFactory(Response.class, qn1),   
 
                      new 
org.apache.axis.encoding.ser.BeanDeserializerFactory(Response.class, 
qn1));

        QName qn2= new QName( "urn:PublicService4", "Param" );

        call.registerTypeMapping(Param.class, qn2,
                      new 
org.apache.axis.encoding.ser.BeanSerializerFactory(Param.class, qn2),  
                      new 
org.apache.axis.encoding.ser.BeanDeserializerFactory(Param.class, qn2));   
 

        Response resp=null;
        try {
           // String url = options.getURL();
            //This will allow the request to go to port 1234 for TCPMon.
            //SetTCPMon listen port to 1234
           // String url = "http://localhost:1234/axis/servlet/AxisServlet";
           // System.out.println("URL:"+ url);
            //call.setTargetEndpointAddress( new java.net.URL(url) );
            call.setTargetEndpointAddress( new 
java.net.URL(options.getURL()) );
            call.setOperationName( new QName("PublicService4", 
"getSeveralBusinessLocation") );
            call.addParameter( "arg1", qn, ParameterMode.IN );
            call.setReturnClass(Response.class);
            resp = (Response) call.invoke( new Object[] { req } );
        } catch (AxisFault fault) {
          String  error = "Error : " + fault.toString();
          System.out.println(error);
        }
        System.out.println("Name               Value");
        System.out.println("------------------------");
        Collection result = resp.getParams();
        Iterator itr = result.iterator();
        while(itr.hasNext()){
            Param p = (Param)itr.next();
            String name = p.getName();
            String value = (String)p.getValue();
            System.out.println(name+"       "+value);

        }
    }
}
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
    <service name="PublicService4" provider="java:RPC" style="wrapped">
        <parameter name="className" value="apacheaxis.PublicService4"/>
        <parameter name="allowedMethods" 
value="getSeveralBusinessLocation"/>
        <beanMapping qname="myNS:Request" xmlns:myNS="urn:PublicService4" 
languageSpecificType="java:apacheaxis.Request"/>
        <beanMapping qname="myNS:Response" xmlns:myNS="urn:PublicService4" 
languageSpecificType="java:apacheaxis.Response"/>
        <beanMapping qname="myNS:Param" xmlns:myNS="urn:PublicService4" 
languageSpecificType="java:apacheaxis.Param"/>
    </service>
</deployment>



Mime
View raw message