Hi David,
Thanks for your response...
I was planning on running my external facing code in the JVM, another reason
I want to use BlazeDS is that it uses a binary protocol, so its more
efficient at sending lots of data.
SO Basicall I will be running it in the same container and my issue is well
the DispatchContext.
I have pasted my test example below... What I have is a service helloPerson
and my testBlaze method which is called by a AMF handling servlet... I was
thinking that if I had the ServletConfig of the AMF request, I could some
how... be able to create the Dispatch Context...
But I am a little lost...
Is this the correct approach? if so Could someone point me to some code that
might help me?
If not how would I do it?
Thanks
import org.ofbiz.entity.GenericValue;
import org.ofbiz.security.Security;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.GeneralServiceException;
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.service.ServiceUtil;
import org.ofbiz.service.ModelService;
import org.ofbiz.service.rmi.RemoteDispatcher;
import org.ofbiz.base.util.UtilMisc;
import java.net.MalformedURLException;
import java.rmi.*;
public class TestServices {
public static String module = TestServices.class.getName();
public static Map helloPerson(DispatchContext dctx, Map context) {
GenericDelegator delegator = dctx.getDelegator();
LocalDispatcher dispatcher = dctx.getDispatcher();
Security security = dctx.getSecurity();
//GenericValue userLogin = (GenericValue) context.get("userLogin");
Locale locale = (Locale) context.get("locale");
Map results = ServiceUtil.returnSuccess();
String name = (String) context.get("name");
String emailAddress = (String) context.get("emailAddress");
results.put("fullString", "hello " + name + " email:"+emailAddress);
return results;
}
public static String testBlaze(String name, String emailAddress)
{
/* RMI Approach.... Could not get working ....
Map results = null;
String info = "";
try
{
RemoteDispatcher rd = (RemoteDispatcher) Naming.lookup
("rmi://127.0.0.1:1099/RMIDispatcher");
results = rd.runSync("catalystic.test.exported", UtilMisc.toMap("name",
"mark", "emailAddress", "[EMAIL PROTECTED]"));
}
catch(GenericServiceException e)
{
info += e.getMessage();
}
catch(NotBoundException nb)
{
info += nb.getMessage();
}
catch(RemoteException rm)
{
info += rm.getMessage();
}
catch(MalformedURLException mue)
{
info += mue.getMessage();
}
*/
// This is a way to get the Servlet Config from my AMF Flex Servlet
Context...
//javax.servlet.ServletConfig currentConfig =
flex.messaging.FlexContext.getServletConfig();
// However I a bit lost on what to do next to call an Ofbiz servlet from
here...
return info;
}
}
On Sat, Mar 15, 2008 at 1:38 AM, David E Jones <[EMAIL PROTECTED]>
wrote:
>
> Unless you're running code in the same JVM, the intention of the
> export flag is to keep it from being run externally.
>
> If you want to get around that for your code, it needs to run in the
> same container (JVM).
>
> BTW, if you make the service responsible for its own security and
> authentication, then it should be fine to export it.
>
> -David
>
>
> On Mar 14, 2008, at 1:05 PM, Mark Ellul wrote:
>
> > Hi
> >
> > We are looking at creating a Flex Front end to Ofbiz.
> >
> > I have been looking at BlazeDS as a way of sending data to a Java
> > Class
> > where I would want to call Ofbiz Services that are not exported (for
> > security reasons)....
> >
> > How can I call a Ofbiz service that is not exported from Java?
> >
> > I have looked at SOAP and RMI and both need to be exported...
> >
> > Is it possible?
> >
> > If not, any ideas on how I could do it?
> >
> > Thanks and Regards
> >
> > Mark
>
>