Document/Literal and org.w3c.dom.Element return type
cboatwright Dec 4, 2006 12:22 AMI read in several places that org.w3c.dom.Element gets mapped to anyType and can be used in Document/Literal endpoints. However, I cannot seem to get a simply test endpoint (using JSR-181 EJB) to work.
Using JBoss 4.0.5.GA w/ JBossWS 1.0.4.GA
@EJB(name="PingBuildLinksEndPointBean", beanInterface=IPingBuildLinksEndPointBean.class, description="This is the ping description", beanName="PingBuildLinksEndPointBean")
@WebService(name="PingBuildLinksEndPoint")
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use=SOAPBinding.Use.LITERAL)
@PortComponent(authMethod="BASIC", urlPattern="/test.ws",transportGuarantee="CONFIDENTIAL")
@RolesAllowed("BLDADM")
@SecurityDomain("BuildLinksWs")
/**
* @author cboatwright
*/
public @Stateless class PingBuildLinksEndPointBean extends AbstractDatabaseSessionEndPoint
implements IPingBuildLinksEndPointBean
{
public PingBuildLinksEndPointBean()
throws CreateException, BuildLinksException
{
super();
}
@WebMethod
public Element elementPing(String arg0)
throws BuildLinksFault
{
Element rv = null;
log.debug("ignored arg0=" + arg0);
try
{
rv = DOMUtils.parse("<helloWorld/>");
}
catch (IOException e)
{
throw new BuildLinksFault(e.getMessage());
}
return rv;
}
I get the following exception (regardless of the length of the XML returned, the above example just has one node):
23:58:03,035 ERROR [[PingBuildLinksEndPointBean]] Servlet.service() for servlet PingBuildLinksEndPointBean threw exception org.jboss.xb.binding.JBossXBRuntimeException: Failed to find read method or field for property '_value' in class org.apache.xerces.dom.DeferredElementNSImpl at org.jboss.xb.binding.introspection.ClassInfo.getFieldInfo(ClassInfo.java:81) at org.jboss.xb.binding.introspection.FieldInfo.getFieldInfo(FieldInfo.java:155) at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.getJavaValue(MarshallerImpl.java:1266) at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.getElementValue(MarshallerImpl.java:1284) .. cut
Any advice on how to send back the result as a well-formed XML element? When I try just to do it as a string, all of the XML reserved characters get escaped ...