accumulating files in server/default/data/wsdl
by Andrew Skiba
Hello,
I've encountered a problem with generated WSDL files on jboss-4.2.3.
To reproduce it, I created an EJB jar with web service class annotated
like this:
@Stateless(mappedName = ICounterManagerWSRemote.NAME, name =
ICounterManagerWSRemote.NAME, description =
ICounterManagerWSRemote.NAME)
@Remote(ICounterManagerWSRemote.class)
@RemoteBinding(jndiBinding =ICounterManagerWSRemote.NAME_REMOTE)
@WebService(name =
"CounterManagerWS", targetNamespace = "urn:countermanagerws",
serviceName = "CounterManagerWS")
@SOAPBinding(style = SOAPBinding.Style.RPC, parameterStyle =
ParameterStyle.BARE)
Then I created an EAR containing this EJB, a WAR which accesses the WS
and deployed it on JBoss. Now every time I start the JBoss server, it
generates a new WSDL like this: server/default/data/wsdl/
ServletStateless.ear/ServletStateless-ejb.jar/
CounterManagerWS2051720417134744551.
wsdl
When the application has many complex web services, these files become
quite big, and are generated on every server start. So my question is:
is this a known issue? What's the best way to handle this problem? Add
an rm command to JBoss startup script?
Thanks.
Andrew.
15 years
[JBoss Web Services Users] - JBOSSWS Webservice Error in UNIX
by narmashan
I am testing a webservice using JBOSS5,JBOSSWS and jdk 6 in unix system.
My webservice got deployed and worked well in Windows. Client was able to able to access the HTTP response fine.
Windows XP Environment Tools:
a) JBOSS AS5
b)JBOSS WS
c)JDK 5.0
Steps followed to install in Windows
# From Windows Explorer, navigate to "C:\jbossws-native-bin-dist". Inside the folder, locate the file "ant.properties.example".
# Make a copy of "ant.properties.example", then rename it to "ant.properties".
# Start up your favorite code editor (like UltraEdit32, or Notepad++), then open up "ant.properties" for editing.
# Locate the line "jboss500.home=(a)jboss500.home@", change it to "jboss500.home=/jboss-5.0.0.GA". Then save it and close the code editor.
# Open Command Prompt, navigate to "C:\jbossws-native-bin-dist". Then run the command "ant deploy-jboss500". When it finishes successfully, JBossWS will be installed and configured properly for use.
Unix Environment:
JDK 6
JBOSS 5.0
Copied the JBOSSWS jar files from C:\jbossws-native-bin-dist\output\deploy-jboss500folder to corresponding folders in client, bin,common,lib,server in Unix.
When I start the JBOSSAS I am able to view the webservice and wsdl is generated but while testing the webservic in client I get the following error:
javax.xml.ws.WebServiceException: Cannot process response message
at org.jboss.ws.core.jaxws.client.DispatchSOAPBinding.getReturnObject(DispatchSOAPBinding.java:191)
at org.jboss.ws.core.jaxws.client.DispatchImpl.getReturnObject(DispatchImpl.java:470)
at org.jboss.ws.core.jaxws.client.DispatchImpl.invokeInternalSOAP(DispatchImpl.java:264)
at org.jboss.ws.core.jaxws.client.DispatchImpl.invokeInternal(DispatchImpl.java:170)
at org.jboss.ws.core.jaxws.client.DispatchImpl.invoke(DispatchImpl.java:133)
at tutorial.hanbo.webservice.GreetingTestClient2.main(GreetingTestClient2.java:60)
Caused by: javax.xml.soap.SOAPException: Cannot obtain SOAPBody from SOAPMessage
at javax.xml.soap.SOAPMessage.getSOAPBody(SOAPMessage.java:181)
at org.jboss.ws.core.jaxws.client.DispatchSOAPBinding.getReturnObject(DispatchSOAPBinding.java:159)
While Analyzing using TCP monitor I find that content length is zero
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1
Content-Length: 0
Date: Thu, 10 Dec 2009 15:27:26 GMT
I assume it has something to do with JBOSSWS jar files used in Unix.
Could anyone help in this regard ? Grealty appreciate it.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4270026#4270026
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4270026
15 years
[JBoss Web Services Users] - Re: How to recieve RPC/encoded SOAP messages in JBoss5?
by shadowcreeper
OK, here's what seems to be working for me... It's a horrible hack, but it works...
First, take your WSDL file and turn it into RPC/literal (for me it was as easy as replacing the word "encoded" with "literal").
Next, setup your JBossWS stuff as though you will be receiving RPC/literal documents (from its standpoint, you will).
Now for the tricky part... You will have already setup a servlet (@WebService), which you now need to add an XSLT filter to...
All I had to do to make my SOAP messages understandable to JBossWS was flatten the "multiRef" nodes.
Original SOAP message:
| <myWebServiceMethod>
| <myArgumentObject href="#id0"/>
| </myWebServiceMethod>
| <multiRef id="id0" ...>
| <actualGutsOfArgument/>
| <referencedGutNum2 href="#id2"/>
| </multiRef>
| <multiRef id="id2" ...>
| <moreActualGuts/>
| </multiRef>
|
Flattened SOAP message:
| <myWebServiceMethod>
| <myArgumentObject id="id0" ...>
| <actualGutsOfArgument/>
| <referencedGutNum2 id="id2" ...>
| <moreActualGuts/>
| </referencedGutNum2>
| </myArgumentObject>
| </myWebServiceMethod>
|
Note: The only attribute I removed was "href", all of the attributes to the multiRef node became attributes to the node that referenced it (this includes xsi:type info which I believe gets ignored anyway since it is already specified in the XSD file that my WSDL references).
The filter will look something like this:
| public class MultiRefFlattener
| implements Filter
| {
| private Transformer m_transformer = null;
|
| public void init ( FilterConfig filterConfig )
| throws ServletException
| {
| final String stylePath = filterConfig.getServletContext().getRealPath( "WEB-INF/multi-ref-flattener.xslt" );
| final Source styleSource = new StreamSource( stylePath );
| final TransformerFactory transformerFactory = TransformerFactory.newInstance();
| try
| {
| m_transformer = transformerFactory.newTransformer( styleSource );
| }
| catch( TransformerConfigurationException e )
| {
| throw new ServletException( "Error creating XSLT transformer: ", e );
| }
| }
|
| public void doFilter(
| final ServletRequest request,
| final ServletResponse response,
| final FilterChain chain )
| throws IOException, ServletException
| {
| final String requestText;
| try
| {
| final CharArrayWriter caw = new CharArrayWriter();
| final StreamResult result = new StreamResult(caw);
| m_transformer.transform(new StreamSource(request.getInputStream()), result);
| requestText = caw.toString();
| }
| catch( TransformerException e )
| {
| throw new ServletException( "Error filtering data" );
| }
|
| final ServletInputStream requestStream = new ServletInputStream()
| {
| private int m_column = 0;
| public int read ()
| throws IOException
| {
| if( m_column >= requestText.length() )
| return -1;
| final int character = requestText.charAt( m_column );
| ++m_column;
| return character;
| }
| };
|
| final HttpServletRequest httpServletRequest = (HttpServletRequest)request;
| final HttpServletRequestWrapper wrapper = new HttpServletRequestWrapper( httpServletRequest )
| {
| @Override
| public int getContentLength ()
| {
| return requestText.length();
| }
|
| @Override
| public ServletInputStream getInputStream ()
| throws IOException
| {
| return requestStream;
| }
| };
| chain.doFilter( wrapper, response );
| }
|
| public void destroy ()
| {
| m_transformer = null;
| }
| }
|
If anybody has a better way of faking an HttpServletRequest, please let me know.
And here is my flattening XSLT file:
| <xsl:stylesheet version="1.0"
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
| xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
| <xsl:template match="/">
| <xsl:call-template name="CopyNode"/>
| </xsl:template>
|
| <xsl:template name="CopyNodeRef">
| <xsl:param name="elementName"/>
| <xsl:param name="hrefId"/>
| <xsl:copy>
| <xsl:element name="$elementName">
| <xsl:for-each select="//multiRef[@id = $hrefId]/@*">
| <xsl:copy>
| <xsl:apply-templates mode="keeping"/>
| </xsl:copy>
| </xsl:for-each>
| <xsl:for-each select="//multiRef[@id = $hrefId]/node()[not(@href)]">
| <xsl:call-template name="CopyNode"/>
| </xsl:for-each>
| <xsl:for-each select="//multiRef[@id = $hrefId]/node()[@href]">
| <xsl:call-template name="CopyNodeRef">
| <xsl:with-param name="elementName" select="name()"/>
| <xsl:with-param name="hrefId" select="substring(@href, 2)"/>
| </xsl:call-template>
| </xsl:for-each>
| </xsl:element>
| </xsl:copy>
| </xsl:template>
|
| <xsl:template name="CopyNode">
| <xsl:copy>
| <xsl:call-template name="CopyAttributes"/>
| <xsl:for-each select="node()[not(@href|@id)]">
| <xsl:call-template name="CopyNode"/>
| </xsl:for-each>
| <xsl:for-each select="node()[@href]">
| <xsl:call-template name="CopyNodeRef">
| <xsl:with-param name="elementName" select="name()"/>
| <xsl:with-param name="hrefId" select="substring(@href, 2)"/>
| </xsl:call-template>
| </xsl:for-each>
| </xsl:copy>
| </xsl:template>
|
| <xsl:template name="CopyAttributes">
| <xsl:for-each select="@*">
| <xsl:copy>
| <xsl:apply-templates mode="keeping"/>
| </xsl:copy>
| </xsl:for-each>
| </xsl:template>
|
| </xsl:stylesheet>
|
If anybody has a better idea for a flattener, please let me know.
I hope this helps.
-Shadow
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269863#4269863
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269863
15 years
[JBoss Web Services Users] - Namespace defined in method tag
by mbarker
I'm deploying a web service on JBoss 4.2. I am a consumer of a vendor's web service. I submit my request and receive a response indicating a successful submission. Some time later, possibly hours, the vendor sends me a status thus I become the provider.
The vendor is sending me the following request. Notice that the namespace is defined in the tag: <Callback xmlns=SomeCallback>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
| <soap:Body>
| <Callback xmlns="SomeCallback">
| <ID>0</ID>
| <ItemID>1362</ItemID>
| <Auth>leopard</Auth>
| <Status>-900</Status>
| <StatusTime>2009-12-08T11:13:52</StatusTime>
| </Callback>
| </soap:Body>
| </soap:Envelope>
My test request (below) defines the namespace before the tag is used: <pos:Callback>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pos="SomeCallback">
| <soapenv:Header/>
| <soapenv:Body>
| <pos:Callback>
| <ID>1</ID>
| <ItemID>2</ItemID>
| <Auth>smitty</Auth>
| <Status>-1000</Status>
| <StatusTime>2009-12-08T11:59:59</StatusTime>
| </pos:Callback>
| </soapenv:Body>
| </soapenv:Envelope>
Here's my code. My web service does receive the request from the vendor, but all the objects are null and int is 0. Namespace is the key. What do I have to change in my code below so that my request matches the vendor's request?
@WebService(targetNamespace = "SomeCallback")
| @SOAPBinding(parameterStyle = ParameterStyle.WRAPPED)
| public class SomeCallback {
|
| @WebMethod(operationName = "Callback")
| public @WebResult(name = "CallbackResult", targetNamespace = "SomeCallback")
| int callback(@WebParam(name = "ID") int id,
| @WebParam(name = "ItemID") int itemId,
| @WebParam(name = "Auth") String auth,
| @WebParam(name = "Status") int status,
| @WebParam(name = "StatusTime") Date statusTime) {
| }
| }
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269843#4269843
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269843
15 years