[JBossWS] - Exception in wstools wsdl-java, unwrap=true
by klease
I'm trying to generate a client for a .net webservice. The wsdl uses the wrapped style with anonymous elmeents for the methods and responses, like this:
<s:element name="TwoParamFunction">
| <s:complexType>
| <s:sequence>
| <s:element minOccurs="0" maxOccurs="1" name="arg1" type="s:string" />
| <s:element minOccurs="0" maxOccurs="1" name="arg2" type="s:string" />
| </s:sequence>
| </s:complexType>
| </s:element>
I run the wstools from the 1.0.3 release, with following parameters.
| <wsdl-java unwrap="true" file="UnwrapBug.wsdl">
| <mapping file="jaxrpc-mapping.xml" />
| </wsdl-java>
|
Environment is linux, jboss 4.0.4.GA, jbossws-1.0.3, jdk 1.5.0_07
I get the following error:
Exception in thread "main" org.jboss.ws.WSException: String passed is null
at org.jboss.ws.metadata.wsdl.WSDLUtils.firstLetterUpperCase(WSDLUtils.java:453)
at org.jboss.ws.tools.XSDTypeToJava.createJavaFile(XSDTypeToJava.java:138)
at org.jboss.ws.tools.XSDTypeToJava.createJavaFile(XSDTypeToJava.java:114)
at org.jboss.ws.tools.WSDLToJava.generateJavaSource(WSDLToJava.java:701) at org.jboss.ws.tools.WSDLToJava.generateJavaSource(WSDLToJava.java:694) at org.jboss.ws.tools.WSDLToJava.unwrapResponse(WSDLToJava.java:321)
at org.jboss.ws.tools.WSDLToJava.getReturnType(WSDLToJava.java:555)
at org.jboss.ws.tools.WSDLToJava.appendMethods(WSDLToJava.java:372)
at org.jboss.ws.tools.WSDLToJava.createSEIFile(WSDLToJava.java:512)
at org.jboss.ws.tools.WSDLToJava.createSEI(WSDLToJava.java:534)
at org.jboss.ws.tools.WSDLToJava.generateSEI(WSDLToJava.java:188)
at org.jboss.ws.tools.helpers.ToolsHelper.handleWSDLToJavaGeneration(ToolsHelper.java:329)
at org.jboss.ws.tools.WSTools.process(WSTools.java:138)
at org.jboss.ws.tools.WSTools.generate(WSTools.java:120)
at org.jboss.ws.tools.WSTools.main(WSTools.java:61)
------------------
I assume this is a bug?
The workaround is to modify the wsdl so that the elements reference separate defined type elements, like this:
| <s:element name="TwoParamFunction" type="tns:TwoParamFunctionType"/>
| <s:complexType name="TwoParamFunctionType">
| <s:sequence>
| <s:element minOccurs="0" maxOccurs="1" name="arg1" type="s:string" />
| <s:element minOccurs="0" maxOccurs="1" name="arg2" type="s:string" />
| </s:sequence>
| </s:complexType>
|
Then correct java is generated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3974363#3974363
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3974363
19 years, 7 months
[JBoss Seam] - Re: Seam remoting -- any plans for FacesContext support?
by andrew.rw.robinson
Okay, I got this to work. I just needed to do a bit of simple OO programming.
1) Extend your servlet and overwrite the "Execute" path handler:
public class SeamRemotingServletEx
| extends SeamRemotingServlet
| {
| private static final String REQUEST_PATH_EXECUTE = "/execute";
|
| /**
| * @see org.jboss.seam.remoting.SeamRemotingServlet#init(javax.servlet.ServletConfig)
| */
| @Override
| public void init(ServletConfig config)
| throws ServletException
| {
| super.init(config);
| RequestHandlerFactory.getInstance().registerHandler(REQUEST_PATH_EXECUTE,
| new FacesExecutionHandler());
| }
| }
2) Write the new handler with faces context support:
public class FacesExecutionHandler
| extends ExecutionHandler
| {
| private ServletContext servletContext;
|
| /**
| * @see org.jboss.seam.remoting.InterfaceGenerator#setServletContext(javax.servlet.ServletContext)
| */
| @Override
| public void setServletContext(ServletContext ctx)
| {
| this.servletContext = ctx;
| super.setServletContext(ctx);
| }
|
| /**
| * @see org.jboss.seam.remoting.InterfaceGenerator#handle(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
| */
| @Override
| public void handle(HttpServletRequest request, HttpServletResponse response)
| throws Exception
| {
| getFacesContext(request, response);
| super.handle(request, response);
| }
|
| protected FacesContext getFacesContext(HttpServletRequest request,
| HttpServletResponse response)
| {
| FacesContext facesContext = FacesContext.getCurrentInstance();
|
| if (facesContext == null)
| {
| FacesContextFactory contextFactory = (FacesContextFactory)FactoryFinder
| .getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
| LifecycleFactory lifecycleFactory = (LifecycleFactory)FactoryFinder
| .getFactory(FactoryFinder.LIFECYCLE_FACTORY);
| Lifecycle lifecycle = lifecycleFactory
| .getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
|
| facesContext = contextFactory.getFacesContext(servletContext, request,
| response, lifecycle);
| }
| return facesContext;
| }
| }
3) register the extended servlet instead of the Seam servlet. Follow all other configuration instruction verbatim.
And that is all she wrote. Now Seam remoting works perfectly fine with JSF. Remoting methods can have full access to JSF scoped beans, access the session through the external context, have "facesContext" be injectable, etc.
Perhaps a flag in some configuration file, or in the JavaScript to enable this? (or on the @WebRemote annotation?)
Thanks,
Andrew
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3974356#3974356
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3974356
19 years, 7 months