1 Reply Latest reply on Jan 17, 2008 9:48 AM by kosmos

    unexpected XML reader state

    kosmos

      We've generated ws client by means of wxconsume from jbossws-native-2.0.2.GA. Everything looked good, until we got an exception.

      javax.xml.ws.WebServiceException: unexpected XML reader state. expected: END_ELEMENT but found: START_ELEMENT
       at com.sun.xml.internal.ws.encoding.soap.client.SOAPXMLDecoder.toInternalMessage(Unknown Source)
       at com.sun.xml.internal.ws.protocol.soap.client.SOAPMessageDispatcher.receive(Unknown Source)
       at com.sun.xml.internal.ws.protocol.soap.client.SOAPMessageDispatcher.doSend(Unknown Source)
       at com.sun.xml.internal.ws.protocol.soap.client.SOAPMessageDispatcher.send(Unknown Source)
       at com.sun.xml.internal.ws.encoding.soap.internal.DelegateBase.send(Unknown Source)
       at com.sun.xml.internal.ws.client.EndpointIFInvocationHandler.implementSEIMethod(Unknown Source)
       at com.sun.xml.internal.ws.client.EndpointIFInvocationHandler.invoke(Unknown Source)
       at $Proxy17.listStudents(Unknown Source)
       at testContingent.main(testContingent.java:32)
      Caused by: unexpected XML reader state. expected: END_ELEMENT but found: START_ELEMENT
       at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.verifyReaderState(Unknown Source)
       at com.sun.xml.internal.ws.encoding.soap.SOAPDecoder.decodeBody(Unknown Source)
       at com.sun.xml.internal.ws.encoding.soap.client.SOAPXMLDecoder.decodeBody(Unknown Source)
       at com.sun.xml.internal.ws.encoding.soap.client.SOAPXMLDecoder.decodeEnvelope(Unknown Source)
       ... 9 more
      


      public class testContingent {
       public static void main(String[] args) {
       Contingent contingent = new Contingent();
       StudentsSrvPort studentsSrvPort = contingent.getContingentSOAP();
       ObjectFactory of = new ObjectFactory();
       ListStudentsRequest listStudentsRequest = of.createListStudentsRequest();
       listStudentsRequest.setFirstName("");
       listStudentsRequest.setMiddleName("");
       listStudentsRequest.setLastName("");
       listStudentsRequest.setStudentState("");
       listStudentsRequest.setGender("");
       listStudentsRequest.setCardNumber("");
       listStudentsRequest.setDisabled(null);
       listStudentsRequest.setDormitory(null);
       listStudentsRequest.setForeign(null);
       listStudentsRequest.setGroup("5-11");
       try{
       List<Student> studList = new ArrayList<Student>(studentsSrvPort.listStudents(listStudentsRequest).getStudent());
      
       if (studList != null) {
       for (Student stud : studList){
       System.out.println(new String((stud.getId()+" "+stud.getName()).getBytes("UTF8")));
       }
       }
       } catch (WebServiceException e) {
       e.printStackTrace();
       } catch (UnsupportedEncodingException e) {
       e.printStackTrace();
       }
       }
      }
      


      Here is our POST

      POST /SOAP HTTP/1.1
      Content-Length: 501
      SOAPAction: "http://contingent.bmstu.ru/listStudents"
      Accept: text/xml, application/xop+xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
      Content-Type: text/xml; charset=utf-8
      User-Agent: Java/1.6.0_01
      Host: contingent.bmstu.ru:144
      Connection: keep-alive
      
      <?xml version="1.0" ?>
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://contingent.bmstu.ru/">
       <soapenv:Body>
       <ns1:listStudentsRequest>
       <ns1:lastName></ns1:lastName>
       <ns1:firstName></ns1:firstName>
       <ns1:middleName></ns1:middleName>
       <ns1:group>5-11</ns1:group>
       <ns1:gender></ns1:gender>
       <ns1:cardNumber></ns1:cardNumber>
       <ns1:studentState></ns1:studentState>
       </ns1:listStudentsRequest>
       </soapenv:Body>
      </soapenv:Envelope>
      


      And server's response
      HTTP/1.1 200
      Server: nginx/0.5.20
      Date: Thu, 17 Jan 2008 13:53:35 GMT
      Content-Type: text/xml; charset=utf-8
      Connection: keep-alive
      Content-length: 38923
      
      <?xml version='1.0'?>
      <soapenv:Envelope xmlns:ns1='http://contingent.bmstu.ru/'
       xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
       xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
       xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
       <soapenv:Body>
       <listStudentsResponse xsi:type='ns1:listStudentsResponse'>
       <student xsi:type='ns1:Student'>
       <id>67b8a137-8636-4c20-9649-00000001b583</id>
       <name>xxx xxx xxx</name>
       <firstName>xxx</firstName>
       <middleName>xxx</middleName>
       <lastName>xxx</lastName>
       <gender xsi:type='ns1:Classifier'>
       <id>2c4fdb64-0c14-4dd1-81c1-000000000001</id>
       <name>xxx</name>
       </gender>
       <cardNumber>07�£024</cardNumber>
       <studyType xsi:type='ns1:Classifier'>
       <id>f3fd113a-e251-4816-b411-000000000001</id>
       <name>xxx</name>
       </studyType>
       <studentState xsi:type='ns1:Classifier'>
       <id>9e32657c-61c5-4e58-8ca6-000000000002</id>
       <name>xxx</name>
       </studentState>
       <dormitory>false</dormitory>
       <group xsi:type='ns1:Group'>
       <id>e3664f92-3b36-430e-a638-000000001afa</id>
       <name>5-11</name>
       </group>
       <profession xsi:type='ns1:ProfessionClassifier'>
       <id>ffffffff-ffff-ffff-ffff-ffffffffffff</id>
       <professionCode>230102</professionCode>
       <specializationCode>00</specializationCode>
       <qualificationCode>65</qualificationCode>
       </profession>
       <disabled>false</disabled>
       <foreign>false</foreign>
       <militaryState xsi:type='ns1:Classifier'>
       <id>a6d7fb86-4925-4aed-89bf-000000000000</id>
       <name/>
       </militaryState>
       </student>
       </listStudentsResponse>
       </soapenv:Body>
      </soapenv:Envelope>
      


      That looks like a bug.