You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Narayanan Nachiappan <re...@yahoo.com> on 2006/01/04 07:42:18 UTC

SimpleDeserializer encountered a child element, which is NOT expected - AXIS Client

  I have created a Webservice (Axis 1.2.1 implementation) of type DOCUMENT Wrapped Style.
   
  There are no issues from the server side.  Through TCP-Mon I’m able to view the response sent back by the Webservice.
   
  But, Axis Client is unable to parse the SOAP response.
   
  I’m getting the following error:
   
  ERROR [org.apache.axis.client.Call] Exception:
  org.xml.sax.SAXException: 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.java:145)
        at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
        at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
        at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
        at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345)
        at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
        at org.apache.axis.client.Call.invoke(Call.java:2448)
        at org.apache.axis.client.Call.invoke(Call.java:2347)
        at org.apache.axis.client.Call.invoke(Call.java:1804)
        at com.xyz.test.TestService.main(TestService.java:153)
  DEBUG [org.apache.axis.utils.NSStack] NSPush (32)
  DEBUG [org.apache.axis.i18n.ProjectResourceBundle] org.apache.axis.i18n.resource::handleGetObject(empty00)
  DEBUG [org.apache.axis.utils.NSStack] NSPop (empty)
  DEBUG [org.apache.axis.utils.NSStack] NSPush (32)
  DEBUG [org.apache.axis.i18n.ProjectResourceBundle] org.apache.axis.i18n.resource::handleGetObject(empty00)
  DEBUG [org.apache.axis.utils.NSStack] NSPop (empty)
  AxisFault
   faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
   faultSubcode: 
   faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
   faultActor: 
   faultNode: 
   faultDetail: 
        {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: 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.java:145)
        at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
        at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
        at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
        at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345)
        at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
        at org.apache.axis.client.Call.invoke(Call.java:2448)
        at org.apache.axis.client.Call.invoke(Call.java:2347)
        at org.apache.axis.client.Call.invoke(Call.java:1804)
        at com.xyz.test.TestService.main(TestService.java:153)
   
        {http://xml.apache.org/axis/}hostname:CDC1-02-534
   
  org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
        at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
        at org.apache.axis.client.Call.invoke(Call.java:2451)
        at org.apache.axis.client.Call.invoke(Call.java:2347)
        at org.apache.axis.client.Call.invoke(Call.java:1804)
        at com.xyz.test.TestService.main(TestService.java:153)
  Caused by: org.xml.sax.SAXException: 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.java:145)
        at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
        at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
        at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
        at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345)
        at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
        at org.apache.axis.client.Call.invoke(Call.java:2448)
        ... 3 more
   
   
  Here is the background information about the Webservice which I have created.
   
  Deploy.wsdd is as follows:
   
  <deployment     name="LocatePharmacy" xmlns="http://xml.apache.org/axis/wsdd/"
                                      xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
   
  <service name="LocatePharmacyService" provider="java:RPC" style="wrapped" use="literal">
              
              <parameter name="className" value="com.xyz.service.LocatePharmacyService" />
              <parameter name="allowedMethods" value="locateByAddress, locateByNABPNumber, getVersion, validateRequest" />
              <beanMapping qname="ns:LocatePharmacyRequest" xmlns:ns="LocatePharmacyService" languageSpecificType="java:com.xyz.data.LocatePharmacyRequest"/>
              <beanMapping qname="ns:Pharmacy" xmlns:ns="LocatePharmacyService" languageSpecificType="java:com.xyz.data.Pharmacy"/>
              <beanMapping qname="ns:MemberDetails" xmlns:ns="LocatePharmacyService" languageSpecificType="java:com.xyz.data.MemberDetails"/>
   
  //Other bean mappings
  .
  .
  .
  .
              
   
  </service>
   
  </deployment>
   
   
  Client code is as follows:
   
                         Service  service = new Service();
                         Call     call    = (Call) service.createCall();
   
                          QName    qn      = new QName( "LocatePharmacyService", "LocatePharmacyRequest" );
   
                          call.registerTypeMapping(com.xyz.data.LocatePharmacyRequest.class, qn,
                                        org.apache.axis.encoding.ser.BeanSerializerFactory.class,
                                        org.apache.axis.encoding.ser.BeanDeserializerFactory.class);
   
                          qn = new QName("LocatePharmacyService", "Pharmacy");
                          call.registerTypeMapping(com.xyz.data.Pharmacy.class, qn,
                                                  org.apache.axis.encoding.ser.BeanSerializerFactory.class,
                                                  org.apache.axis.encoding.ser.BeanDeserializerFactory.class);
   
                            //REGISTER ALL BEAN SERIALIZERS with respect to deploy.wsdd
   
              call.setTargetEndpointAddress( new java.net.URL(endpoint) );
                         call.setOperationName(new QName("LocatePharmacyService", "locateByNABPNumber"));
   
                          // CONSTRUCT the request object
   
                         LocatePharmacyResponse ret = (LocatePharmacyResponse) call.invoke( new Object[] { request } );
   
                         System.out.println("Response = " + ret);               
   
  Webservice Details:
   
              I’m passing a user-defined Object (LocatePharmacyRequest).  It returns a user-defined object (LocatePharmacyResponse).  This user-defined object (LocatePharmacyResponse) in turn encapsulates a user-defined object(array).
   
              public LocatePharmacyResponse locateByNABPNumber(
                                      LocatePharmacyRequest locatorPharmacyRequest) {
                          ErrorList errorList = new ErrorList();
                          return component.locateByNABPNumber(locatorPharmacyRequest,errorList);
              }
   
   
  Can anyone please help me out in resolving this issue?
   
   
  Looking forward for your great help.
   
  Thanks & Regards,
  Nachiappan.N



		
---------------------------------
 Yahoo! DSL Something to write home about. Just $16.99/mo. or less

Re: SimpleDeserializer encountered a child element, which is NOT expected - AXIS Client

Posted by jayachandra <ja...@gmail.com>.
I suggest you do the following.

** MAKE SURE THE HELPER CLASSES YOU ARE USING ALL HAVE A DEFAULT EMPTY
CONSTRUCTOR **
Then use Axis's Java2WSDL and WSDL2Java tools to create your artifacts
(server and client) and host the service. All things should be in place
then.

Regards
Jayachandra

On 1/4/06, Narayanan Nachiappan <re...@yahoo.com> wrote:
>
> Jayachandra,
>
>      Since, I already have Java component in place, i have exposed it as a
> WebService using deploy.wsdd alone.
>
>      Axis Client i wrote it manually.
>
>      If my approach is wrong, please guide on to overcome this issue?
>
> Thanks & Regards,
> Nachiappan.N
>
> *jayachandra <ja...@gmail.com>* wrote:
>
> How did u create your artifacts (both client and server), is it through
> Axis. If yes, let me know.
>
> Jayachandra
>
> On 1/4/06, Narayanan Nachiappan <re...@yahoo.com> wrote:
> >
> >  I have created a Webservice (Axis 1.2.1 implementation) of type
> > DOCUMENT Wrapped Style.
> >
> > There are no issues from the server side.  Through TCP-Mon I'm able to
> > view the response sent back by the Webservice.
> >
> > But, Axis Client is unable to parse the SOAP response.
> >
> > I'm getting the following error:
> >
> > ERROR [org.apache.axis.client.Call] Exception:
> > org.xml.sax.SAXException: 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.java:145)
> >       at org.apache.axis.encoding.DeserializationContext.startElement(
> > DeserializationContext.java:1035)
> >       at org.apache.axis.message.SAX2EventRecorder.replay(
> > SAX2EventRecorder.java:165)
> >       at org.apache.axis.message.MessageElement.publishToHandler(
> > MessageElement.java:1141)
> >       at org.apache.axis.message.RPCElement.deserialize(RPCElement.java
> > :345)
> >       at org.apache.axis.message.RPCElement.getParams(RPCElement.java
> > :384)
> >       at org.apache.axis.client.Call.invoke(Call.java:2448)
> >       at org.apache.axis.client.Call.invoke(Call.java:2347)
> >       at org.apache.axis.client.Call.invoke(Call.java:1804)
> >        at com.xyz.test.TestService.main(TestService.java:153)
> > DEBUG [org.apache.axis.utils.NSStack] NSPush (32)
> > DEBUG [org.apache.axis.i18n.ProjectResourceBundle]
> > org.apache.axis.i18n.resource::handleGetObject(empty00)
> > DEBUG [org.apache.axis.utils.NSStack] NSPop (empty)
> > DEBUG [org.apache.axis.utils.NSStack] NSPush (32)
> > DEBUG [org.apache.axis.i18n.ProjectResourceBundle]
> > org.apache.axis.i18n.resource::handleGetObject(empty00)
> > DEBUG [org.apache.axis.utils.NSStack] NSPop (empty)
> > AxisFault
> >  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException<http://schemas.xmlsoap.org/soap/envelope/%7DServer.userException>
> >  faultSubcode:
> >  faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a
> > child element, which is NOT expected, in something it was trying to
> > deserialize.
> >  faultActor:
> >  faultNode:
> >  faultDetail:
> >       { http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException<http://xml.apache.org/axis/%7DstackTrace:org.xml.sax.SAXException>:
> > 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.java:145)
> >       at org.apache.axis.encoding.DeserializationContext.startElement(
> > DeserializationContext.java:1035)
> >       at org.apache.axis.message.SAX2EventRecorder.replay(
> > SAX2EventRecorder.java:165)
> >       at org.apache.axis.message.MessageElement.publishToHandler(
> > MessageElement.java:1141)
> >       at org.apache.axis.message.RPCElement.deserialize(RPCElement.java
> > :345)
> >       at org.apache.axis.message.RPCElement.getParams(RPCElement.java
> > :384)
> >       at org.apache.axis.client.Call.invoke(Call.java:2448)
> >       at org.apache.axis.client.Call.invoke(Call.java:2347)
> >       at org.apache.axis.client.Call.invoke(Call.java:1804)
> >       at com.xyz.test.TestService.main(TestService.java:153)
> >
> >       { http://xml.apache.org/axis/}hostname:CDC1-02-534<http://xml.apache.org/axis/%7Dhostname:CDC1-02-534>
> >
> > org.xml.sax.SAXException: SimpleDeserializer encountered a child
> > element, which is NOT expected, in something it was trying to deserialize.
> >       at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
> >       at org.apache.axis.client.Call.invoke(Call.java:2451)
> >       at org.apache.axis.client.Call.invoke(Call.java:2347)
> >       at org.apache.axis.client.Call.invoke(Call.java:1804)
> >       at com.xyz.test.TestService.main(TestService.java:153)
> > Caused by: org.xml.sax.SAXException: SimpleDeserializer encountered a
> > child element, which is NOT expected, in something it was trying to
> > deserialize.
> >     &nbsp ; at
> > org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(
> > SimpleDeserializer.java:145)
> >       at org.apache.axis.encoding.DeserializationContext.startElement(
> > DeserializationContext.java:1035)
> >       at org.apache.axis.message.SAX2EventRecorder.replay(
> > SAX2EventRecorder.java:165)
> >       at org.apache.axis.message.MessageElement.publishToHandler(
> > MessageElement.java:1141)
> >       at org.apache.axis.message.RPCElement.deserialize(RPCElement.java
> > :345)
> >       at org.apache.axis.message.RPCElement.getParams(RPCElement.java
> > :384)
> >       at org.apache.axis.client.Call.invoke(Call.java:2448)
> >       ... 3 more
> >
> >
> > Here is the background information about the Webservice which I have
> > created.
> >
> > Deploy.wsdd is as follows:
> >
> > <deployment     name="LocatePharmacy" xmlns="http://xml.apache.org/axis/wsdd/
> > "
> >                                     xmlns:java="http://xml.apache.org/axis/wsdd/providers/java
> > ">
> >
> > <service name="LocatePharmacyService" provider="java:RPC"
> > style="wrapped" use="literal">
> >
> >             <parameter name="className" value="
> > com.xyz.service.LocatePharmacyService" />
> >             <parameter name="allowedMethods" value="locateByAddress,
> > locateByNABPNumber, getVersion, validateRequest" />
> >          &nbsp ;  <beanMapping qname="ns:LocatePharmacyRequest"
> > xmlns:ns="LocatePharmacyService" languageSpecificType="java:
> > com.xyz.data.LocatePharmacyRequest"/>
> >             <beanMapping qname="ns:Pharmacy"
> > xmlns:ns="LocatePharmacyService" languageSpecificType="java:
> > com.xyz.data.Pharmacy"/>
> >             <beanMapping qname="ns:MemberDetails"
> > xmlns:ns="LocatePharmacyService" languageSpecificType="java:
> > com.xyz.data.MemberDetails"/>
> >
> > //Other bean mappings
> > .
> > .
> > .
> > .
> >
> >
> > </service>
> >
> > </deployment>
> >
> >
> > Client code is as follows:
> >
> >                        Service  service = new Service();
> >                        Call     call    = (Call) service.createCall();
> >
> >                         QName    qn      = new QName(
> > "LocatePharmacyService", "LocatePharmacyRequest" );
> >
> >                         call.registerTypeMapping(
> > com.xyz.data.LocatePharmacyRequest.class, qn,
> >
> > org.apache.axis.encoding.ser.BeanSerializerFactory.class,
> >
> > org.apache.axis.encoding.ser.BeanDeserializerFactory.class);
> >
> >                         qn = new QName("LocatePharmacyService",
> > "Pharmacy");
> >                         call.registerTypeMapping(
> > com.xyz.data.Pharmacy.class, qn,
> >
> > org.apache.axis.encoding.ser.BeanSerializerFactory.class,
> >
> > org.apache.axis.encoding.ser.BeanDeserializerFactory.class);
> >
> >                          //REGISTER ALL BEAN SERIALIZERS with respect to
> > deploy.wsdd
> >
> >             call.setTargetEndpointAddress( new java.net.URL(endpoint) );
> >                        call.setOperationName(new
> > QName("LocatePharmacyService", "locateByNABPNumber"));
> >
> >                         // CONSTRUCT the request object
> >
> >                        LocatePharmacyResponse ret =
> > (LocatePharmacyResponse) call.invoke( new Object[] { request } );
> >
> >                        System.out.println("Response = " +
> > ret);
> >
> > Webservice Details:
> >
> >             I'm passing a user-defined Object (LocatePharmacyRequest).
> >  It returns a user-defined object (LocatePharmacyResponse).  This
> > user-defined object (LocatePharmacyResponse) in turn encap sulates a
> > user-defined object(array).
> >
> >             public LocatePharmacyResponse locateByNABPNumber(
> >                                     LocatePharmacyRequest
> > locatorPharmacyRequest) {
> >                         ErrorList errorList = new ErrorList();
> >                         return component.locateByNABPNumber
> > (locatorPharmacyRequest,errorList);
> >             }
> >
> >
> > Can anyone please help me out in resolving this issue?
> >
> >
> > Looking forward for your great help.
> >
> > Thanks & Regards,
> > Nachiappan.N
> >  ------------------------------
> > Yahoo! DSL<http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=37474/*http://promo.yahoo.com/broadband/+>Something to write home about. Just $16.99/mo. or less
> >
>
>
>
> --
> -- Jaya
>
>
>
>
> ------------------------------
> Yahoo! Photos
> Ring in the New Year with Photo Calendars<http://us.rd.yahoo.com/mail_us/taglines/photos/*http://pg.photos.yahoo.com/ph//page?.file=calendar_splash.html&.dir=>.
> Add photos, events, holidays, whatever.
>
>


--
-- Jaya

Re: SimpleDeserializer encountered a child element, which is NOT expected - AXIS Client

Posted by Narayanan Nachiappan <re...@yahoo.com>.
Jayachandra,
   
       Since, I already have Java component in place, i have exposed it as a WebService using deploy.wsdd alone.
   
       Axis Client i wrote it manually.
   
       If my approach is wrong, please guide on to overcome this issue?
   
  Thanks & Regards,
  Nachiappan.N

jayachandra <ja...@gmail.com> wrote:
    How did u create your artifacts (both client and server), is it through Axis. If yes, let me know.
 
  Jayachandra
 
  On 1/4/06, Narayanan Nachiappan <re...@yahoo.com> wrote:       I have created a Webservice (Axis 1.2.1 implementation) of type DOCUMENT Wrapped Style.
   
  There are no issues from the server side.  Through TCP-Mon I'm able to view the response sent back by the Webservice.
   
  But, Axis Client is unable to parse the SOAP response.
   
  I'm getting the following error:
   
  ERROR [org.apache.axis.client.Call] Exception: 
  org.xml.sax.SAXException: 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.java:145) 
        at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035) 
        at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165) 
        at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141) 
        at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345) 
        at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384) 
        at org.apache.axis.client.Call.invoke(Call.java:2448) 
        at org.apache.axis.client.Call.invoke(Call.java:2347) 
        at org.apache.axis.client.Call.invoke(Call.java:1804) 
         at com.xyz.test.TestService.main(TestService.java:153) 
  DEBUG [org.apache.axis.utils.NSStack] NSPush (32) 
  DEBUG [org.apache.axis.i18n.ProjectResourceBundle] org.apache.axis.i18n.resource::handleGetObject(empty00) 
  DEBUG [org.apache.axis.utils.NSStack] NSPop (empty) 
  DEBUG [org.apache.axis.utils.NSStack] NSPush (32) 
  DEBUG [org.apache.axis.i18n.ProjectResourceBundle] org.apache.axis.i18n.resource::handleGetObject(empty00) 
  DEBUG [org.apache.axis.utils.NSStack] NSPop (empty) 
  AxisFault
   faultCode: { http://schemas.xmlsoap.org/soap/envelope/}Server.userException
   faultSubcode: 
   faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize. 
   faultActor: 
   faultNode: 
   faultDetail: 
        { http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: 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.java:145) 
        at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035) 
        at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165) 
        at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141) 
        at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345) 
        at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384) 
        at org.apache.axis.client.Call.invoke(Call.java:2448) 
        at org.apache.axis.client.Call.invoke(Call.java:2347) 
        at org.apache.axis.client.Call.invoke(Call.java:1804) 
        at com.xyz.test.TestService.main(TestService.java:153) 
   
        { http://xml.apache.org/axis/}hostname:CDC1-02-534
   
  org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize. 
        at org.apache.axis.AxisFault.makeFault(AxisFault.java:101) 
        at org.apache.axis.client.Call.invoke(Call.java:2451) 
        at org.apache.axis.client.Call.invoke(Call.java:2347) 
        at org.apache.axis.client.Call.invoke(Call.java:1804) 
        at com.xyz.test.TestService.main(TestService.java:153) 
  Caused by: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize. 
      &nbsp ; at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145) 
        at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035) 
        at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165) 
        at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141) 
        at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345) 
        at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384) 
        at org.apache.axis.client.Call.invoke(Call.java:2448) 
        ... 3 more 
   
   
  Here is the background information about the Webservice which I have created.
   
  Deploy.wsdd is as follows:
   
  <deployment     name="LocatePharmacy" xmlns=" http://xml.apache.org/axis/wsdd/"
                                      xmlns:java=" http://xml.apache.org/axis/wsdd/providers/java">
   
  <service name="LocatePharmacyService" provider="java:RPC" style="wrapped" use="literal"> 
              
              <parameter name="className" value="com.xyz.service.LocatePharmacyService" /> 
              <parameter name="allowedMethods" value="locateByAddress, locateByNABPNumber, getVersion, validateRequest" /> 
           &nbsp ;  <beanMapping qname="ns:LocatePharmacyRequest" xmlns:ns="LocatePharmacyService" languageSpecificType="java: com.xyz.data.LocatePharmacyRequest"/>
              <beanMapping qname="ns:Pharmacy" xmlns:ns="LocatePharmacyService" languageSpecificType="java: com.xyz.data.Pharmacy"/>
              <beanMapping qname="ns:MemberDetails" xmlns:ns="LocatePharmacyService" languageSpecificType="java: com.xyz.data.MemberDetails"/>
   
  //Other bean mappings
  .
  .
  .
  .
              
   
  </service>
   
  </deployment>
   
   
  Client code is as follows:
   
                         Service  service = new Service();
                         Call     call    = (Call) service.createCall();
   
                          QName    qn      = new QName( "LocatePharmacyService", "LocatePharmacyRequest" ); 
   
                          call.registerTypeMapping(com.xyz.data.LocatePharmacyRequest.class, qn,
                                        org.apache.axis.encoding.ser.BeanSerializerFactory.class,
                                        org.apache.axis.encoding.ser.BeanDeserializerFactory.class);
   
                          qn = new QName("LocatePharmacyService", "Pharmacy");
                          call.registerTypeMapping(com.xyz.data.Pharmacy.class, qn,
                                                  org.apache.axis.encoding.ser.BeanSerializerFactory.class,
                                                  org.apache.axis.encoding.ser.BeanDeserializerFactory.class);
   
                            //REGISTER ALL BEAN SERIALIZERS with respect to deploy.wsdd
   
              call.setTargetEndpointAddress( new java.net.URL(endpoint) );
                         call.setOperationName(new QName("LocatePharmacyService", "locateByNABPNumber")); 
   
                          // CONSTRUCT the request object
   
                         LocatePharmacyResponse ret = (LocatePharmacyResponse) call.invoke( new Object[] { request } );
   
                         System.out.println("Response = " + ret);               
   
  Webservice Details:
   
              I'm passing a user-defined Object (LocatePharmacyRequest).  It returns a user-defined object (LocatePharmacyResponse).  This user-defined object (LocatePharmacyResponse) in turn encap sulates a user-defined object(array). 
   
              public LocatePharmacyResponse locateByNABPNumber(
                                      LocatePharmacyRequest locatorPharmacyRequest) {
                          ErrorList errorList = new ErrorList();
                          return component.locateByNABPNumber(locatorPharmacyRequest,errorList);
              }
   
   
  Can anyone please help me out in resolving this issue?
   
   
  Looking forward for your great help.
   
  Thanks & Regards,
  Nachiappan.N


    
---------------------------------
  Yahoo! DSL Something to write home about. Just $16.99/mo. or less   
  




-- 
-- Jaya   


			
---------------------------------
Yahoo! Photos
 Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.

Re: SimpleDeserializer encountered a child element, which is NOT expected - AXIS Client

Posted by jayachandra <ja...@gmail.com>.
How did u create your artifacts (both client and server), is it through
Axis. If yes, let me know.

Jayachandra

On 1/4/06, Narayanan Nachiappan <re...@yahoo.com> wrote:
>
>  I have created a Webservice (Axis 1.2.1 implementation) of type DOCUMENT
> Wrapped Style.
>
> There are no issues from the server side.  Through TCP-Mon I'm able to
> view the response sent back by the Webservice.
>
> But, Axis Client is unable to parse the SOAP response.
>
> I'm getting the following error:
>
> ERROR [org.apache.axis.client.Call] Exception:
> org.xml.sax.SAXException: 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.java:145)
>       at org.apache.axis.encoding.DeserializationContext.startElement(
> DeserializationContext.java:1035)
>       at org.apache.axis.message.SAX2EventRecorder.replay(
> SAX2EventRecorder.java:165)
>       at org.apache.axis.message.MessageElement.publishToHandler(
> MessageElement.java:1141)
>       at org.apache.axis.message.RPCElement.deserialize(RPCElement.java
> :345)
>       at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
>       at org.apache.axis.client.Call.invoke(Call.java:2448)
>       at org.apache.axis.client.Call.invoke(Call.java:2347)
>       at org.apache.axis.client.Call.invoke(Call.java:1804)
>        at com.xyz.test.TestService.main(TestService.java:153)
> DEBUG [org.apache.axis.utils.NSStack] NSPush (32)
> DEBUG [org.apache.axis.i18n.ProjectResourceBundle]
> org.apache.axis.i18n.resource::handleGetObject(empty00)
> DEBUG [org.apache.axis.utils.NSStack] NSPop (empty)
> DEBUG [org.apache.axis.utils.NSStack] NSPush (32)
> DEBUG [org.apache.axis.i18n.ProjectResourceBundle]
> org.apache.axis.i18n.resource::handleGetObject(empty00)
> DEBUG [org.apache.axis.utils.NSStack] NSPop (empty)
> AxisFault
>  faultCode: {
> http://schemas.xmlsoap.org/soap/envelope/}Server.userException<http://schemas.xmlsoap.org/soap/envelope/%7DServer.userException>
>  faultSubcode:
>  faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a
> child element, which is NOT expected, in something it was trying to
> deserialize.
>  faultActor:
>  faultNode:
>  faultDetail:
>       {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException<http://xml.apache.org/axis/%7DstackTrace:org.xml.sax.SAXException>:
> 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.java:145)
>       at org.apache.axis.encoding.DeserializationContext.startElement(
> DeserializationContext.java:1035)
>       at org.apache.axis.message.SAX2EventRecorder.replay(
> SAX2EventRecorder.java:165)
>       at org.apache.axis.message.MessageElement.publishToHandler(
> MessageElement.java:1141)
>       at org.apache.axis.message.RPCElement.deserialize(RPCElement.java
> :345)
>       at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
>       at org.apache.axis.client.Call.invoke(Call.java:2448)
>       at org.apache.axis.client.Call.invoke(Call.java:2347)
>       at org.apache.axis.client.Call.invoke(Call.java:1804)
>       at com.xyz.test.TestService.main(TestService.java:153)
>
>       {http://xml.apache.org/axis/}hostname:CDC1-02-534<http://xml.apache.org/axis/%7Dhostname:CDC1-02-534>
>
> org.xml.sax.SAXException: SimpleDeserializer encountered a child element,
> which is NOT expected, in something it was trying to deserialize.
>       at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
>       at org.apache.axis.client.Call.invoke(Call.java:2451)
>       at org.apache.axis.client.Call.invoke(Call.java:2347)
>       at org.apache.axis.client.Call.invoke(Call.java:1804)
>       at com.xyz.test.TestService.main(TestService.java:153)
> Caused by: org.xml.sax.SAXException: SimpleDeserializer encountered a
> child element, which is NOT expected, in something it was trying to
> deserialize.
>     &nbsp ; at
> org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(
> SimpleDeserializer.java:145)
>       at org.apache.axis.encoding.DeserializationContext.startElement(
> DeserializationContext.java:1035)
>       at org.apache.axis.message.SAX2EventRecorder.replay(
> SAX2EventRecorder.java:165)
>       at org.apache.axis.message.MessageElement.publishToHandler(
> MessageElement.java:1141)
>       at org.apache.axis.message.RPCElement.deserialize(RPCElement.java
> :345)
>       at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
>       at org.apache.axis.client.Call.invoke(Call.java:2448)
>       ... 3 more
>
>
> Here is the background information about the Webservice which I have
> created.
>
> Deploy.wsdd is as follows:
>
> <deployment     name="LocatePharmacy" xmlns="
> http://xml.apache.org/axis/wsdd/"
>                                     xmlns:java="
> http://xml.apache.org/axis/wsdd/providers/java">
>
> <service name="LocatePharmacyService" provider="java:RPC" style="wrapped"
> use="literal">
>
>             <parameter name="className" value="
> com.xyz.service.LocatePharmacyService" />
>             <parameter name="allowedMethods" value="locateByAddress,
> locateByNABPNumber, getVersion, validateRequest" />
>          &nbsp ;  <beanMapping qname="ns:LocatePharmacyRequest"
> xmlns:ns="LocatePharmacyService" languageSpecificType="java:
> com.xyz.data.LocatePharmacyRequest"/>
>             <beanMapping qname="ns:Pharmacy"
> xmlns:ns="LocatePharmacyService" languageSpecificType="java:
> com.xyz.data.Pharmacy"/>
>             <beanMapping qname="ns:MemberDetails"
> xmlns:ns="LocatePharmacyService" languageSpecificType="java:
> com.xyz.data.MemberDetails"/>
>
> //Other bean mappings
> .
> .
> .
> .
>
>
> </service>
>
> </deployment>
>
>
> Client code is as follows:
>
>                        Service  service = new Service();
>                        Call     call    = (Call) service.createCall();
>
>                         QName    qn      = new QName(
> "LocatePharmacyService", "LocatePharmacyRequest" );
>
>                         call.registerTypeMapping(
> com.xyz.data.LocatePharmacyRequest.class, qn,
>
> org.apache.axis.encoding.ser.BeanSerializerFactory.class,
>
> org.apache.axis.encoding.ser.BeanDeserializerFactory.class);
>
>                         qn = new QName("LocatePharmacyService",
> "Pharmacy");
>                         call.registerTypeMapping(
> com.xyz.data.Pharmacy.class, qn,
>
> org.apache.axis.encoding.ser.BeanSerializerFactory.class,
>
> org.apache.axis.encoding.ser.BeanDeserializerFactory.class);
>
>                          //REGISTER ALL BEAN SERIALIZERS with respect to
> deploy.wsdd
>
>             call.setTargetEndpointAddress( new java.net.URL(endpoint) );
>                        call.setOperationName(new
> QName("LocatePharmacyService", "locateByNABPNumber"));
>
>                         // CONSTRUCT the request object
>
>                        LocatePharmacyResponse ret =
> (LocatePharmacyResponse) call.invoke( new Object[] { request } );
>
>                        System.out.println("Response = " +
> ret);
>
> Webservice Details:
>
>             I'm passing a user-defined Object (LocatePharmacyRequest).  It
> returns a user-defined object (LocatePharmacyResponse).  This user-defined
> object (LocatePharmacyResponse) in turn encap sulates a user-defined
> object(array).
>
>             public LocatePharmacyResponse locateByNABPNumber(
>                                     LocatePharmacyRequest
> locatorPharmacyRequest) {
>                         ErrorList errorList = new ErrorList();
>                         return component.locateByNABPNumber
> (locatorPharmacyRequest,errorList);
>             }
>
>
> Can anyone please help me out in resolving this issue?
>
>
> Looking forward for your great help.
>
> Thanks & Regards,
> Nachiappan.N
>
> ------------------------------
> Yahoo! DSL<http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=37474/*http://promo.yahoo.com/broadband/+>Something to write home about. Just $16.99/mo. or less
>
>


--
-- Jaya