[JBoss Microcontainer Users] - Re: Running a deployer on resource in classpath
by alesj
"rareddy" wrote :
| Then I thought there is no "deployment unit" available for this to be invoked, so added "@ManagementDeployment" and "@ManagementObject" annotations to my metadata object "SystemVDBMetadata" class and deployed that object, this object is available as input to the deployer by adding "setInput", still the deployer never invoked.
|
|
| | @ManagementObject
| | @ManagementDeployment(types = {"vdb"})
| | public class SystemVDBMetadata implements Serializable {
| | }
| |
|
There is no need for this -- this is just for management features, ProfileService etc.
"rareddy" wrote :
| What I am confused is what will be my deployment unit in this case, as the resource I want to load is inside a JAR in "lib" directory. My intention was use the above code and once I am in the "deploy" call use the technique mentioned above to load resource.
|
Who creates and attaches this SystemVDBMetadata to DeploymentUnit?
Parsing deployers only look into metadata locations.
For spec defined deployments these are:
* META-INF for .jar and .ear
* WEB-INF for .war
(see StructureDeployer(s) for more details)
So, jar's lib directory won't be checked unless you explicitly configure it.
The DeploymentUnit == (Sub)Deployment == .ear or .war or .jar
(.jar which is not just lib, but real (sub)deployment)
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269866#4269866
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269866
15 years, 2 months
[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, 2 months
[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, 2 months
[jBPM Users] - Re: [jbpm 4.2] Finding a Process Instance
by saraswati.santanu
Name of the command service and the id-generator are to be changed in 4.2. Yours is for 4.1. But you should have got exception at some other step because of these. This is a sample cfg file for 4.2
| <jbpm-configuration>
|
| <import resource="jbpm.businesscalendar.cfg.xml" />
| <import resource="jbpm.jpdl.cfg.xml" />
|
| <process-engine-context>
| <repository-service />
| <repository-cache />
| <execution-service />
| <history-service />
| <management-service />
| <task-service />
| <identity-service />
| <command-service name="txRequiredCommandService">
| <skip-interceptor />
| <retry-interceptor />
| <environment-interceptor />
| <standard-transaction-interceptor />
| </command-service>
|
| <hibernate-configuration>
| <cfg resource="jbpm.hibernate.cfg.xml" />
| </hibernate-configuration>
|
| <hibernate-session-factory />
|
| <object class="org.jbpm.pvm.internal.id.DatabaseDbidGenerator">
| <field name="commandService"><ref object="txRequiredCommandService" /></field>
| </object>
|
| <object class="org.jbpm.pvm.internal.id.DatabaseIdComposer" init="eager" />
|
| <script-manager default-expression-language="juel" default-script-language="juel">
| <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
| </script-manager>
|
| <job-executor auto-start="false" />
|
| <types resource="jbpm.variable.types.xml" />
| </process-engine-context>
|
| <transaction-context>
| <repository-session/>
| <db-session/>
|
| <message-session/>
| <timer-session/>
| <hibernate-session current="true"/>
| </transaction-context>
|
| </jbpm-configuration>
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269842#4269842
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269842
15 years, 2 months
[JBoss Microcontainer Users] - Re: Running a deployer on resource in classpath
by rareddy
I extended the my deployer using the AbstractSimpleVFSRealDeployer as below
| public class SystemVDBDeployer extends AbstractSimpleVFSRealDeployer<SystemVDBMetadata> {
|
| public SystemVDBDeployer() {
| super(SystemVDBMetadata.class);
| }
|
| @Override
| public void deploy(VFSDeploymentUnit unit, SystemVDBMetadata deployment)
| throws DeploymentException {
| System.out.println("My deployer invoked");
| }
| }
|
added the "-jboss-beans.xml" file to the "deployers" directory, but "deploy" call never invoked by the container.
Then I thought there is no "deployment unit" available for this to be invoked, so added "@ManagementDeployment" and "@ManagementObject" annotations to my metadata object "SystemVDBMetadata" class and deployed that object, this object is available as input to the deployer by adding "setInput", still the deployer never invoked.
| @ManagementObject
| @ManagementDeployment(types = {"vdb"})
| public class SystemVDBMetadata implements Serializable {
| }
|
What I am confused is what will be my deployment unit in this case, as the resource I want to load is inside a JAR in "lib" directory. My intention was use the above code and once I am in the "deploy" call use the technique mentioned above to load resource.
Any suggestions as what I may be doing wrong?
Thank you.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269840#4269840
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269840
15 years, 2 months
[EJB 3.0 Users] - Re: unidirectional and bidirectional relationship
by amira88
"Wolfgang Knauf" wrote : Hi,
|
| assume that you have a relation "Person has many addresses" with two entities "Person" and "Address".
|
| If you declare a bidirectional relationship, your code can navigate from Person to Address, and from Adress to Person.
|
| With a unidirectional relationship, your code can navigate only from one side to the other. E.g. you can get the addresses of a person, but you cannot get the person of an address.
|
| The database representation of the relationship is not affected by your unidirectional/bidirectional decision. This defines only, how the code side looks like.
|
| Hope this helps
|
| Wolfgang
tHANK U so much sir ,
Now i can see the difference but i have a new question another time, i'm developping an oaw project so after generating
the code i have to build tables, That's why i used jboss ,but when i wanna add the oaw project in the server(add and remove option by right click on the sever ),i can not find the name of the oaw project ,So i created a new ejb3 project and i copy and paste the generated class into it finally i added
the annotation and the relation ships into entities is it a good idea!!!
Because My collegues add annotation (ejb3 code)in the Template!!
That's why i'm wondering ,and I'm afraid if made a mistake!!
What do you think Sir Knauf!!
Viele Danke für Ihre Hilfe!!
Thank you for ur help
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269838#4269838
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269838
15 years, 2 months