Announcement Announcement Module
Collapse
No announcement yet.
Web Service client: SimpleDeserializer encountered a child element, NOT expected Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Web Service client: SimpleDeserializer encountered a child element, NOT expected

    I'm using a Web Service client using spring-ws-rc2, with WebServiceTemplate, although I can access the WebService with JMeter, I am getting an error with spring-ws.

    What I get from spring-ws is :-

    <soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <faultcode>soapenv:Server.userException</faultcode>
    <faultstring>org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.</faultstring>
    <detail />
    </soapenv:Fault>

    I have tried both the default SaajSoapMessageFactory and the AxiomSoapMessageFactory but both give same. The soap message I am sending is loaded from a file on the classpath, and has the same contents as the JMeter request. I use sendSourceAndReceiveToResult(requestSource, result) like the echoClient.

    What I should get back (like JMeter) is :-

    (I have edited below after my original post)
    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
    <ns1:loadPromotionsSyncResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://service.intf.dprj.evant.com"/>
    </soapenv:Body>
    </soapenv:Envelope>

    I did google 'org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize'

    and came across a few quotes saying, some implementations can't cope with arrays very well, and the WSDL does have arrays.

    I cannot change the WSDL, as I'm just the client of Web Service in this case.
    Last edited by PeteTh; Jun 15th, 2007, 12:19 PM.

  • #2
    Apologies I have solved the above error, I had stupidly included the

    <SOAP-ENV:Envelope

    infront of my body xml in the request file.

    Comment


    • #3
      Exception

      Hai friend i'm getting same error but i dnt know where i have fix the problem ... pleac check the below the wsdl the let me know u knw the solution


      QName qName = new QName("http://impl.screentimer.hubino.com","getUsersProject");
      QName qNameReq = new QName("http://impl.screentimer.hubino.com","LoginRequest");
      QName qNameRes = new QName("http://impl.screentimer.hubino.com","CommonResponse");
      Service service = new Service();
      Call call = (Call) service.createCall();

      call.setTargetEndpointAddress(new java.net.URL("http://localhost:8080/screentimer/services/ScreentimerImpl?wsdl?wsdl"));

      call.setOperationName(qName);

      call.registerTypeMapping(LoginRequest.class, qNameReq, new BeanSerializerFactory(LoginRequest.class, qNameReq), new BeanDeserializerFactory(LoginRequest.class, qNameReq));
      call.addParameter("param1", qNameReq, ParameterMode.IN);

      call.registerTypeMapping(CommonResponse.class, qNameRes, new BeanSerializerFactory(CommonResponse.class,qNameRe s), new BeanDeserializerFactory(CommonResponse.class, qNameRes));
      call.setReturnType(qNameRes);

      commonResponse = (CommonResponse) call.invoke(new Object[]{loginRequest});

      Comment

      Working...
      X