Uploaded image for project: 'JBoss Web Services'
  1. JBoss Web Services
  2. JBWS-775

ComplexType cannot be constructed from attributes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • jbossws-1.0.0
    • jbossws-1.0.0.CR4
    • jbossws-native
    • None
    • Workaround Exists
    • Hide

      revert to the axis-based stack

      Show
      revert to the axis-based stack
    • Medium

      Consider the attached web service archive. When deployed, it publishes one RPC and one document endpoint which provide language translation functions. One operation takes a document made up of several text paragraphs and returns it translated to a different language. The attached test case sends the following envelope:

      <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
      <env:Body>
      <sns:translationRequest targetLanguage='es' xmlns:sns='http://example.com/translator/types' xmlns:vendor='http://jbpm.org/bpel'>
      <sns:document>
      <head language='en' title='letter'/>
      <body>
      <paragraph>hi</paragraph>
      <paragraph>bye</paragraph>
      </body>
      </sns:document>
      </sns:translationRequest>
      </env:Body>
      </env:Envelope>

      The server receives an identical message and unmarshalls it to the following object graph:

      public class TTranslationRequest {
      protected String targetLanguage;
      protected TDocument document;
      }

      public class TDocument {
      protected TDocumentHead head;
      protected TDocumentBody body;
      }

      public class TDocumentHead {
      protected String title;
      protected String language;
      }

      Interestingly, the generated TDocument head instance has the "title" field set to "en" and the "language" field set to "letter" for the above envelope. The bundled jaxrpc-mapping.xml document was generated by JWSDP and contains the proper mappings. Just for fun, I assigned the attribute "title" to the field "language" and vice-versa. It didn't work. Afterwards, I changed the order of the attributes in the message I send to the endpoint, which also failed.

        1. translator.war
          22 kB
          Alejandro Guizar
        2. PortCallerTest.java
          9 kB
          Alejandro Guizar

            tdiesler@redhat.com Thomas Diesler
            aguizar_jira Alejandro Guizar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: