0 Replies Latest reply on Sep 25, 2008 4:07 AM by 659012

    Error while passing non built in java type as parameter to webservice

    659012
      I am developing webservice application using Dynamic Proxy client. I am using Weblogic8.1 as my application server. All my services are generated using servicegen and clientgen task of Ant.

      While using Dynamic Proxy client to invoke webservice, i am passing array of my POJO class. I am generating types using generateTypes option of the service task so that it generates serialized class automatically. But while passing this array object as an input parameter to webservice, i am getting below error -

      [java] General exception thrown
      [java] java.lang.reflect.UndeclaredThrowableException
      [java] at $Proxy0.lookup(Unknown Source)
      [java] at cititru.scan.transScan.createGiService(transScan.java:47)
      [java] at cititru.scan.transScan.main(transScan.java:22)
      [java] Caused by: java.rmi.RemoteException: Failed to invoke; nested
      exception is:
      [java] javax.xml.rpc.JAXRPCException: web service invoke failed:
      javax.xml.soap.SOAPException: failed to serialize class [Lcititru.api.interdict.gi.ScannedTextData;weblogic.xml.schema.binding.SerializationException:
      mapping lookup failure. class=class Lcititru.api.interdict.gi.ScannedTextData; class context=TypedClassContext{schemaType=['java:cititru.api.interdict.gi']:ArrayOfScannedTextData}
      [java] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      [java] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      [java] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:27)
      [java] at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
      [java] at weblogic.webservice.core.rpc.StubImpl.throwRemoteException(StubImpl.java:266)
      [java] at weblogic.webservice.core.rpc.StubImpl.invoke(StubImpl.java:251)
      [java] ... 3 more
      [java] Caused by: javax.xml.rpc.JAXRPCException: web service invoke failed: javax.xml.soap.SOAPException: failed to serialize class [Lcititru.api.interdict.gi.ScannedTextData;weblogic.xml.schema.binding.SerializationException:
      mapping lookup failure. class=class[Lcititru.api.interdict.gi.ScannedTextData; classcontext=TypedClassContext{schemaType=['java:cititru.api.interdict.gi']:ArrayOfScannedTextData}
      [java] at weblogic.webservice.core.rpc.StubImpl._invoke(StubImpl.java:331)
      [java] at weblogic.webservice.core.rpc.StubImpl.invoke(StubImpl.java:247)
      [java] ... 3 more

      In the above error message ScannedTextData is my POJO class which i am passing as an input parameter to webservice. Please suggest me what needs to be done to resolve the above issue.

      I am also pasting code snippet of my Dynamic Proxy client.
      ------------------------------------------------------------------------------------------------------------------------------
      String wsdlURL = "http://localhost:7001/ws_gi_server/GiService?WSDL";
      String namespace = "http://www.polaris.co.in/ws_gi_server";
      String serviceName = "GiService";
      String portName = "GiServicePort";

      ServiceFactory serviceFactory = ServiceFactory.newInstance();
      QName service_Name = new QName(namespace, serviceName);
      Service sampleService = serviceFactory.createService(new URL(wsdlURL), service_Name);

      TypeMappingRegistry tmr = sampleService.getTypeMappingRegistry();
      TypeMapping tm = (TypeMapping)tmr.createTypeMapping();
      tm.register(ScannedTextData.class, service_Name, new ScannedTextDataCodec(), new ScannedTextDataCodec());
                
      /* Service access */
      GiServerInterface gi = (GiServerInterface) sampleService.getPort(new QName(namespace, portName),
                     GiServerInterface.class);
      /* Service invocation */
      bluReplyData = gi.lookup("MUMBAI",ruleSet,"EXECUTOR1",std);
      ------------------------------------------------------------------------------------------------------------------------------

      Edited by: user10239703 on Sep 25, 2008 9:32 AM