[JBoss Seam] - Re: Embeddable Objects (EJB3) not working properly
by jboss-Nth-Fan
"gavin.king(a)jboss.com" wrote : Note that none of these questions have anything to do with Seam. Now, I don't mind if you discuss your JSF problems here. But if you are going to talk about bugs and use italics and exclamation points and multiple question marks, please consider taking this to the correct place which would be the MyFaces forum.
|
| OTOH, if you wish to continue this discussion here, that is fine by me, but please lay off of the "bug or incompatibility" talk. Thanks.
Hi Gavin,
Here is a twist to the topic:
I've came to appreciate the power and strengths of JSF, and I really love the way Seam takes over in the places where JSF really needed some help.
(s:Link with actions, nicely formated exception stack trace, pages.xml, etc etc)
Now from having seen colleagues to struggle with JSF somewhat non-obvious ways of doing things (or presenting errors, misconfig, etc..)
Wouldn't this be another case where seam can improve things?
It looks to me like some sort of "auto-converter" could alliviate the need to look into JSF non-friendly details.
Just my $0.02
Yeyo
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958986#3958986
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958986
19 years, 9 months
[Beginners Corner] - entities, clients, eager vs lazy fetch (ejb3)
by jeff plummer
I have a newbie question that is probably so common there is probably a "pattern" that answers it.
I am building an app where the client code will allow the operator to display/edit an object's data. In order to do that the client must have access somehow to all the object's data, atleast depending on the "view" the client is displaying.
I can setup relationships to be "eager", but that seems like hitting a finishing nail with a sledge hammer. A client view really only needs acess to a subset of all the data associated with an object.
I can have several session bean methods that provide different "fetch-join" combinations - one for each client view. But this also seems inefficient.
What I really want is the session bean gets a subset of the data (entity and some of the related objects) and returns it to the client. Then somehow, whenever the client needs more data (i.e. calls entity.getWidgets(), when related widgets were not pre-fetched) it goes back to the database and gets those widgets.
Whats the proper way to do this?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958985#3958985
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958985
19 years, 9 months
[JBossWS] - Re: Problem with SOAP Attachments using EJB 2.1 Web Service
by mnorthu
FYI - this is the code in the Handler
package com.rtn.ejb;
import java.io.*;
import java.util.*;
import java.util.logging.*;
import javax.activation.*;
import javax.xml.namespace.*;
import javax.xml.rpc.handler.*;
import javax.xml.rpc.handler.soap.*;
import javax.xml.soap.*;
import com.rtn.util.*;
public final class AttachmentHandler extends GenericHandler
{
private static QName[] EMPTY = new QName[0];
/**
* Returns an empty array of headers.
*
* @return an empty array of headers.
*/
public QName[] getHeaders()
{
return EMPTY;
}
@Override
public boolean handleResponse( MessageContext context )
{
SOAPMessageContext mctx = ( SOAPMessageContext )context;
try
{
String dataFileStr = ( String )mctx.getProperty( "PRODUCT_ATTACHMENT_FILE_NAME" );
String cid = ( String )mctx.getProperty( "PRODUCT_ATTACHMENT_CID" );
if ( dataFileStr == null || cid == null )
{
LOGGER.info( "No attachment detected." );
return true;
}
FileInputStream dataFileIn = new FileInputStream( dataFileStr );
DataHandler dataHandler = new DataHandler( new ByteArrayDataSource(
dataFileIn, "text/xml" ) );
AttachmentPart att = mctx.getMessage().createAttachmentPart(
dataHandler );
att.setContentId( "<" + cid + ">" );
mctx.getMessage().addAttachmentPart( att );
// doesn't seem to make a difference...
// mctx.getMessage().saveChanges();
// this is for logging only...
java.io.ByteArrayOutputStream out = new ByteArrayOutputStream();
mctx.getMessage().writeTo( out );
LOGGER.info( "Message content: " + out.toString() );
}
catch ( Exception e )
{
LOGGER.warning( "Exception in handleResponse: " + e.getMessage() );
LOGGER.info( "Returning false..." );
return false;
}
LOGGER.info( "Returning true..." );
return true;
}
private static final String CLASSNAME = AttachmentHandler.class.getName();
private static final Logger LOGGER = Logger.getLogger( CLASSNAME );
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958980#3958980
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958980
19 years, 9 months
[JBossWS] - Problem with SOAP Attachments using EJB 2.1 Web Service Endp
by mnorthu
We are trying to build an interoperable web service implemented using an EJB 2.1 service endpoint. We are starting from WSDL using Sun's tools (wscompile) to generate ties, etc. The deployment consists only of an ejb-jar file with the appropriate deployment descriptors. The web service should run on any J2EE 1.4 appserver but I'm having trouble with JBOSS.
The web service allows for download of arbitrary files; therefore the mime-type of the response is not known ahead of time.
For maximum interoperability the attachments are sent via document/literal WSDL using SwaRef/xsd:anyURI according to Sun's example:
https://jax-rpc.dev.java.net/whitepaper/1.1.2/attachments-howto.html
As such, my business method generates and returns a java.net.URI (the Content-ID of the attachment). Using properties on the EJB MessageContext and SAAJ I am attempting to create/add the attachment to the SOAP response using a custom handler declared in webservices.xml
By using SOAPMessage.writeTo( System.out ) the logs appear to show the correct SOAP message:
11:33:23,890 ERROR [STDERR] Jul 18, 2006 11:33:23 AM com.rtn.ejb.AttachmentHandler handleResponse
INFO: Message content:
------=_Part_2_150842.1153240403820
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <rootpart(a)ws.jboss.org>
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
<env:Header/>
<env:Body>
<ns1:retrieveProductResponse xmlns:ns1='java:com.rtn.ejb' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
cid:result=realData.xml@rtn.com
</ns1:retrieveProductResponse>
</env:Body>
</env:Envelope>
------=_Part_2_150842.1153240403820
Content-Type: text/xml
Content-Transfer-Encoding: binary
Content-Id: <result=realData.xml(a)rtn.com>
<?xml version="1.0" encoding="UTF-8"?>
<!-- test example of an XML attachment -->
hello, world!
------=_Part_2_150842.1153240403820--
However, using a TCP Monitor program it appears that the SOAPMessage isn't getting onto the wire properly.
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.0.4.GA (build: CVSTag=JBoss_4_0_4_GA date=200605151000)/Tomcat-5.5
Set-Cookie: JSESSIONID=0764D1BC6FB60F654B3E38ECAEF7F36F; Path=/
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 18 Jul 2006 23:05:05 GMT
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header/>
<env:Body><ns1:retrieveProductResponse xmlns:ns1='java:com.rtn.ejb' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>cid:result=realData.xml@rtn.com
</ns1:retrieveProductResponse>
</env:Body>
</env:Envelope>
Somehow JBOSS is not saving my attachment or it is reverting to the SOAP message as it existed before the handler got invoked...?
I am disappointed to find very little information regarding this and EJB endpoints on the Web. I have created a sample ANT script and test case and can provide it for evaluation. If anyone has implemented something like this please let me know what I'm doing wrong.
Thanks,
~Max
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958979#3958979
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958979
19 years, 9 months
[JBoss Seam] - Re: Embeddable Objects (EJB3) not working properly
by niesar
Hi, petemuir!
thanks a lot for taking a second look at my problem. I really appreciate that!!!
"petemuir" wrote : 1) No, the issue is most likely with your code. Having you tried cleaning and rebuilding from scratch.
Well, I kind of started from scratch. However. my real worls starting point was kind of complicated. So I had to reduce complexity step by step and finally ended in the ClassA/ClassE test case I showed you before.
"petemuir" wrote : 2) Yes, I do, and it works exactly as I would expect it to for me.
This backs Gavin's promise. I'm absolutely convinced now I'm doing something wrong...
"petemuir" wrote :
| If you are still stuck perhaps put your runnable test case up somewhere and I can look at it.
That's extremely nice! Thank's a lot!!!
If you don't mind - let me come home first (I'm more or less on the other side of the planet by now and don't have the test code with me). If I can't solve the issue I will happily send you my code.
Thanks a lot for this offer, petemuir!!!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958978#3958978
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958978
19 years, 9 months