[jboss-user] [JBoss Web Services] - How do I register additional JAXB types during WS deploy?

Steffen Krause do-not-reply at jboss.com
Thu May 17 16:16:19 EDT 2012


Steffen Krause [https://community.jboss.org/people/kimba74] created the discussion

"How do I register additional JAXB types during WS deploy?"

To view the discussion, visit: https://community.jboss.org/message/736355#736355

--------------------------------------------------------------
I have the following problem:

Assuming I created a JSE Web Service using the JSR-181 annotations, I created the necessary JAXB classes, and deployed the WAR file to JBossAS 5.1 with the result that the following WSDL is being generated:

<definitions name='AnyTestService' 
                  targetNamespace='urn:any:test:service:1.0'
                  xmlns='http://schemas.xmlsoap.org/wsdl/'
                  xmlns:ns1='urn:any:test:binding:one:1.0'
                  xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
                  xmlns:tns='urn:any:test:service:1.0'
                  xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<types>
  <xs:schema elementFormDefault='qualified' targetNamespace='urn:any:test:binding:one:1.0' version='1.0' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
   <xs:element name='AnyTestRequest'>
    <xs:complexType>
     <xs:sequence>
      <xs:element name='Name' type='xs:string'/>
      <xs:any namespace='##other' processContents='lax'/>
     </xs:sequence>
    </xs:complexType>
   </xs:element>
   <xs:element name='AnyTestResponse'>
    <xs:complexType>
     <xs:sequence>
      <xs:element name='Code' type='xs:int'/>
      <xs:element name='Status' type='xs:string'/>
     </xs:sequence>
    </xs:complexType>
   </xs:element>
  </xs:schema>
</types>
<message name='AnyTestSEI_Test'>
  <part element='ns1:AnyTestRequest' name='req'></part>
</message>
<message name='AnyTestSEI_TestResponse'>
  <part element='ns1:AnyTestResponse' name='res'></part>
</message>
<portType name='AnyTestSEI'>
  <operation name='Test' parameterOrder='req'>
   <input message='tns:AnyTestSEI_Test'></input>
   <output message='tns:AnyTestSEI_TestResponse'></output>
  </operation>
</portType>
<binding name='AnyTestSEIBinding' type='tns:AnyTestSEI'>
  <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
  <operation name='Test'>
   <soap:operation soapAction=''/>
   <input>
    <soap:body use='literal'/>
   </input>
   <output>
    <soap:body use='literal'/>
   </output>
  </operation>
</binding>
<service name='AnyTestService'>
  <port binding='tns:AnyTestSEIBinding' name='AnyTestPort'>
   <soap:address location='http://127.0.0.1:8080/sandbox/service/anytest'/>
  </port>
</service>
</definitions>



Now I connect to the Web Service with for example soapUI and call it using the following SOAP message

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                              xmlns:urn="urn:any:test:binding:one:1.0"
                              xmlns:lsb="urn:any:test:binding:two:1.0">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:AnyTestRequest>
         <urn:Name>Test</urn:Name>
         <lsb:root>
                     <lsb:Status>Everything is OK</lsb:Status>
         </lsb:root>
      </urn:AnyTestRequest>
   </soapenv:Body>
</soapenv:Envelope>



When I handle the Web Service call in the implementation...

package com.test.service.any;
 
import com.test.binding.one.AnyTestRequest;
import com.test.binding.one.AnyTestResponse;
 
import javax.jws.WebService;
 
@WebService(portName = "AnyTestPort",
      serviceName = "AnyTestService",
      targetNamespace = "urn:any:test:service:1.0",
      endpointInterface = "com.test.service.any.AnyTestSEI")
public class AnyTestWS implements AnyTestSEI {
  
   public AnyTestResponse test(AnyTestRequest request) {
      System.out.println(request);
      if (request.getAny() != null)
         System.out.println("--> ANY=" + request.getAny().getClass());
      return new AnyTestResponse(200, "Received");
   }
   
}


...the Class of the the "ANY" object is as expected org.apache.xerces.dom.ElementNSImpl

Now I create a JAXB class com.test.binding.two.Root to handle the namespace urn:any:test:binding:two:1.0 (+the one that was submitted as ANY object+) package it as JAR file and bundle it in the WEB-INF/lib of the WAR file. 

How do I get JBossAS 5.1 to register this unreferenced JAXB type with the other JAXB types that will be handed to the JAXBContext before unmarshalling it?

Thanks,

Kimba
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/736355#736355]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120517/ac958945/attachment-0001.html 


More information about the jboss-user mailing list