Using Axis w/ OFBiz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Using Axis w/ OFBiz

atoner
Hi.

I am trying to expose services in OFBiz through Axis2 deployed in the same container.  Basically I am trying to use a Symfony front-end to make SOAP calls to perform functions such as adding an item to a shopping cart or retrieving shopping cart contents.  I am doing this by writing a few (what I thought would be) simple SOAP services in Axis to accomplish this.

But I am having a lot of problems and haven’t found much in the mailing list archives or on the forums which helps.

I am able to call the SOAP services, the problem is using the OFBiz internals within the services.  For instance, calling ShoppingCartEvents.getCartObject() always returns a null pointer.  Perhaps I am just looking in the wrong place.

Could anyone steer me in the direction of how I would go about creating and then adding a product/item to a shopping cart and getting its contents?  This is the current code I have:

        public String addItemToCart( String productId )
        {
                MessageContext msgCtx = MessageContext.getCurrentMessageContext();
                HttpServletRequest request = (HttpServletRequest) msgCtx.getProperty( "transport.http.servletRequest" );
               
        Locale locale = UtilHttp.getLocale(request);
               
                ShoppingCart shoppingCart = ShoppingCartEvents.getCartObject( request, locale, "USD"  );
               
                return (String) shoppingCart.getOrderType();
        }

Thanks!

Reply | Threaded
Open this post in threaded view
|

Re: Using Axis w/ OFBiz

David E Jones-3

If you're running in-container, why use web services?

As for the ShoppingCartEvents.getCartObject() method... is the request  
you are passing to it in the web session of the user? No, it is in the  
web session of the SOAP service...

-David


On Feb 22, 2009, at 12:36 PM, atoner wrote:

>
> Hi.
>
> I am trying to expose services in OFBiz through Axis2 deployed in  
> the same
> container.  Basically I am trying to use a Symfony front-end to make  
> SOAP
> calls to perform functions such as adding an item to a shopping cart  
> or
> retrieving shopping cart contents.  I am doing this by writing a few  
> (what I
> thought would be) simple SOAP services in Axis to accomplish this.
>
> But I am having a lot of problems and haven’t found much in the  
> mailing list
> archives or on the forums which helps.
>
> I am able to call the SOAP services, the problem is using the OFBiz
> internals within the services.  For instance, calling
> ShoppingCartEvents.getCartObject() always returns a null pointer.  
> Perhaps I
> am just looking in the wrong place.
>
> Could anyone steer me in the direction of how I would go about  
> creating and
> then adding a product/item to a shopping cart and getting its  
> contents?
> This is the current code I have:
>
> public String addItemToCart( String productId )
> {
> MessageContext msgCtx = MessageContext.getCurrentMessageContext();
> HttpServletRequest request = (HttpServletRequest)  
> msgCtx.getProperty(
> "transport.http.servletRequest" );
>
>        Locale locale = UtilHttp.getLocale(request);
>
> ShoppingCart shoppingCart =  
> ShoppingCartEvents.getCartObject( request,
> locale, "USD"  );
>
> return (String) shoppingCart.getOrderType();
> }
>
> Thanks!
>
>
> --
> View this message in context: http://www.nabble.com/Using-Axis-w--OFBiz-tp22150583p22150583.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|

Re: Using Axis w/ OFBiz

Vince Clark
David - we are running Axis within the OFBiz container to have access natively to OFBiz services. We are not using OFBiz to render the UI. Basically we want to consume all the ecommerce functionality, but do it thru web services so we can build our interface using PHP.

----- Original Message -----
From: "David E Jones" <[hidden email]>
To: [hidden email]
Sent: Sunday, February 22, 2009 4:51:16 PM (GMT-0700) America/Denver
Subject: Re: Using Axis w/ OFBiz


If you're running in-container, why use web services?

As for the ShoppingCartEvents.getCartObject() method... is the request
you are passing to it in the web session of the user? No, it is in the
web session of the SOAP service...

-David


On Feb 22, 2009, at 12:36 PM, atoner wrote:

>
> Hi.
>
> I am trying to expose services in OFBiz through Axis2 deployed in
> the same
> container. Basically I am trying to use a Symfony front-end to make
> SOAP
> calls to perform functions such as adding an item to a shopping cart
> or
> retrieving shopping cart contents. I am doing this by writing a few
> (what I
> thought would be) simple SOAP services in Axis to accomplish this.
>
> But I am having a lot of problems and haven’t found much in the
> mailing list
> archives or on the forums which helps.
>
> I am able to call the SOAP services, the problem is using the OFBiz
> internals within the services. For instance, calling
> ShoppingCartEvents.getCartObject() always returns a null pointer.
> Perhaps I
> am just looking in the wrong place.
>
> Could anyone steer me in the direction of how I would go about
> creating and
> then adding a product/item to a shopping cart and getting its
> contents?
> This is the current code I have:
>
> public String addItemToCart( String productId )
> {
> MessageContext msgCtx = MessageContext.getCurrentMessageContext();
> HttpServletRequest request = (HttpServletRequest)
> msgCtx.getProperty(
> "transport.http.servletRequest" );
>
> Locale locale = UtilHttp.getLocale(request);
>
> ShoppingCart shoppingCart =
> ShoppingCartEvents.getCartObject( request,
> locale, "USD" );
>
> return (String) shoppingCart.getOrderType();
> }
>
> Thanks!
>
>
> --
> View this message in context: http://www.nabble.com/Using-Axis-w--OFBiz-tp22150583p22150583.html 
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|

Re: Using Axis w/ OFBiz

Jacques Le Roux
Administrator
Did you have a look at
http://docs.ofbiz.org/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo#FAQ-Tips-Tricks-Cookbook-HowTo-Soap
Else why not ServiceMix ?

Jacques

From: "Vince M. Clark" <[hidden email]>
David - we are running Axis within the OFBiz container to have access natively to OFBiz services. We are not using OFBiz to render
the UI. Basically we want to consume all the ecommerce functionality, but do it thru web services so we can build our interface
using PHP.

----- Original Message -----
From: "David E Jones" <[hidden email]>
To: [hidden email]
Sent: Sunday, February 22, 2009 4:51:16 PM (GMT-0700) America/Denver
Subject: Re: Using Axis w/ OFBiz


If you're running in-container, why use web services?

As for the ShoppingCartEvents.getCartObject() method... is the request
you are passing to it in the web session of the user? No, it is in the
web session of the SOAP service...

-David


On Feb 22, 2009, at 12:36 PM, atoner wrote:

>
> Hi.
>
> I am trying to expose services in OFBiz through Axis2 deployed in
> the same
> container. Basically I am trying to use a Symfony front-end to make
> SOAP
> calls to perform functions such as adding an item to a shopping cart
> or
> retrieving shopping cart contents. I am doing this by writing a few
> (what I
> thought would be) simple SOAP services in Axis to accomplish this.
>
> But I am having a lot of problems and haven’t found much in the
> mailing list
> archives or on the forums which helps.
>
> I am able to call the SOAP services, the problem is using the OFBiz
> internals within the services. For instance, calling
> ShoppingCartEvents.getCartObject() always returns a null pointer.
> Perhaps I
> am just looking in the wrong place.
>
> Could anyone steer me in the direction of how I would go about
> creating and
> then adding a product/item to a shopping cart and getting its
> contents?
> This is the current code I have:
>
> public String addItemToCart( String productId )
> {
> MessageContext msgCtx = MessageContext.getCurrentMessageContext();
> HttpServletRequest request = (HttpServletRequest)
> msgCtx.getProperty(
> "transport.http.servletRequest" );
>
> Locale locale = UtilHttp.getLocale(request);
>
> ShoppingCart shoppingCart =
> ShoppingCartEvents.getCartObject( request,
> locale, "USD" );
>
> return (String) shoppingCart.getOrderType();
> }
>
> Thanks!
>
>
> --
> View this message in context: http://www.nabble.com/Using-Axis-w--OFBiz-tp22150583p22150583.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>



Reply | Threaded
Open this post in threaded view
|

Re: Using Axis w/ OFBiz

Vince Clark
Yes we have read the how to. The examples in it stop short of actually calling an OFBiz service. We have been able to call simple services in OFBiz like getOrderStatus and return a string.

Why are you suggesting ServiceMix? We would certainly consider it if we needed an ESB. But for what we are trying to accomplish I think we would have the same difficulties as we are having now. If you think differently please advise.

----- Original Message -----
From: "Jacques Le Roux" <[hidden email]>
To: [hidden email]
Sent: Monday, February 23, 2009 12:58:30 AM (GMT-0700) America/Denver
Subject: Re: Using Axis w/ OFBiz

Did you have a look at
http://docs.ofbiz.org/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo#FAQ-Tips-Tricks-Cookbook-HowTo-Soap 
Else why not ServiceMix ?

Jacques

From: "Vince M. Clark" <[hidden email]>
David - we are running Axis within the OFBiz container to have access natively to OFBiz services. We are not using OFBiz to render
the UI. Basically we want to consume all the ecommerce functionality, but do it thru web services so we can build our interface
using PHP.

----- Original Message -----
From: "David E Jones" <[hidden email]>
To: [hidden email]
Sent: Sunday, February 22, 2009 4:51:16 PM (GMT-0700) America/Denver
Subject: Re: Using Axis w/ OFBiz


If you're running in-container, why use web services?

As for the ShoppingCartEvents.getCartObject() method... is the request
you are passing to it in the web session of the user? No, it is in the
web session of the SOAP service...

-David


On Feb 22, 2009, at 12:36 PM, atoner wrote:

>
> Hi.
>
> I am trying to expose services in OFBiz through Axis2 deployed in
> the same
> container. Basically I am trying to use a Symfony front-end to make
> SOAP
> calls to perform functions such as adding an item to a shopping cart
> or
> retrieving shopping cart contents. I am doing this by writing a few
> (what I
> thought would be) simple SOAP services in Axis to accomplish this.
>
> But I am having a lot of problems and haven’t found much in the
> mailing list
> archives or on the forums which helps.
>
> I am able to call the SOAP services, the problem is using the OFBiz
> internals within the services. For instance, calling
> ShoppingCartEvents.getCartObject() always returns a null pointer.
> Perhaps I
> am just looking in the wrong place.
>
> Could anyone steer me in the direction of how I would go about
> creating and
> then adding a product/item to a shopping cart and getting its
> contents?
> This is the current code I have:
>
> public String addItemToCart( String productId )
> {
> MessageContext msgCtx = MessageContext.getCurrentMessageContext();
> HttpServletRequest request = (HttpServletRequest)
> msgCtx.getProperty(
> "transport.http.servletRequest" );
>
> Locale locale = UtilHttp.getLocale(request);
>
> ShoppingCart shoppingCart =
> ShoppingCartEvents.getCartObject( request,
> locale, "USD" );
>
> return (String) shoppingCart.getOrderType();
> }
>
> Thanks!
>
>
> --
> View this message in context: http://www.nabble.com/Using-Axis-w--OFBiz-tp22150583p22150583.html 
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>



Reply | Threaded
Open this post in threaded view
|

Re: Using Axis w/ OFBiz

David E Jones-3
In reply to this post by Vince Clark

Maybe we're getting confused by terminology...

I wouldn't consider calling an OFBiz service through SOAP a way to  
"have access natively to OFBiz services". The whole point of SOAP is  
to NOT have any sort of "native" or "in-container" interaction with  
another system. On the other hand if you are running your code in the  
same container as the rest of OFBiz, why not using something that is  
easier, faster, less code, more flexibility, and less problems with  
object types, etc?

If you're in the same container, you don't even have to use the  
RemoteDispatcher (which is what I'd recommend if you are writing  
something that can be OFBiz-aware as it allows you to call services  
running remotely and treat them as if they were running locally.  
However, if you're in-container you can get a LocalDispatcher instance  
and do a real "native" call that avoids the overhead of serialization,  
going through the network interface (even if it is on the same machine  
it is much slower), etc.

-David


On Feb 22, 2009, at 4:49 PM, Vince M. Clark wrote:

> David - we are running Axis within the OFBiz container to have  
> access natively to OFBiz services. We are not using OFBiz to render  
> the UI. Basically we want to consume all the ecommerce  
> functionality, but do it thru web services so we can build our  
> interface using PHP.
>
> ----- Original Message -----
> From: "David E Jones" <[hidden email]>
> To: [hidden email]
> Sent: Sunday, February 22, 2009 4:51:16 PM (GMT-0700) America/Denver
> Subject: Re: Using Axis w/ OFBiz
>
>
> If you're running in-container, why use web services?
>
> As for the ShoppingCartEvents.getCartObject() method... is the request
> you are passing to it in the web session of the user? No, it is in the
> web session of the SOAP service...
>
> -David
>
>
> On Feb 22, 2009, at 12:36 PM, atoner wrote:
>
>>
>> Hi.
>>
>> I am trying to expose services in OFBiz through Axis2 deployed in
>> the same
>> container. Basically I am trying to use a Symfony front-end to make
>> SOAP
>> calls to perform functions such as adding an item to a shopping cart
>> or
>> retrieving shopping cart contents. I am doing this by writing a few
>> (what I
>> thought would be) simple SOAP services in Axis to accomplish this.
>>
>> But I am having a lot of problems and haven’t found much in the
>> mailing list
>> archives or on the forums which helps.
>>
>> I am able to call the SOAP services, the problem is using the OFBiz
>> internals within the services. For instance, calling
>> ShoppingCartEvents.getCartObject() always returns a null pointer.
>> Perhaps I
>> am just looking in the wrong place.
>>
>> Could anyone steer me in the direction of how I would go about
>> creating and
>> then adding a product/item to a shopping cart and getting its
>> contents?
>> This is the current code I have:
>>
>> public String addItemToCart( String productId )
>> {
>> MessageContext msgCtx = MessageContext.getCurrentMessageContext();
>> HttpServletRequest request = (HttpServletRequest)
>> msgCtx.getProperty(
>> "transport.http.servletRequest" );
>>
>> Locale locale = UtilHttp.getLocale(request);
>>
>> ShoppingCart shoppingCart =
>> ShoppingCartEvents.getCartObject( request,
>> locale, "USD" );
>>
>> return (String) shoppingCart.getOrderType();
>> }
>>
>> Thanks!
>>
>>
>> --
>> View this message in context: http://www.nabble.com/Using-Axis-w--OFBiz-tp22150583p22150583.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Using Axis w/ OFBiz

Jacques Le Roux
Administrator
In reply to this post by Vince Clark
I was (quickly) suggesting ServiceMix because I saw you wanted to use OFBiz services as Web Services from outside OFBiz (and not
from another OFBiz instance) and it's one of the way of doing that.
ServiceMix is not only a complete ESB but also an easy to use JBI container with ActiveMQ (JMS) integrated which offers a lot of
possibilities OOTB (as they say <<that combines the functionality of a Service Oriented Architecture (SOA) and an Event Driven
Architecture (EDA)>>)

Anyway from the discussion you had later with David I'm not sure you need it, indeed...

Jacques

From: "Vince M. Clark" <[hidden email]>
Yes we have read the how to. The examples in it stop short of actually calling an OFBiz service. We have been able to call simple
services in OFBiz like getOrderStatus and return a string.

Why are you suggesting ServiceMix? We would certainly consider it if we needed an ESB. But for what we are trying to accomplish I
think we would have the same difficulties as we are having now. If you think differently please advise.

----- Original Message -----
From: "Jacques Le Roux" <[hidden email]>
To: [hidden email]
Sent: Monday, February 23, 2009 12:58:30 AM (GMT-0700) America/Denver
Subject: Re: Using Axis w/ OFBiz

Did you have a look at
http://docs.ofbiz.org/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo#FAQ-Tips-Tricks-Cookbook-HowTo-Soap
Else why not ServiceMix ?

Jacques

From: "Vince M. Clark" <[hidden email]>
David - we are running Axis within the OFBiz container to have access natively to OFBiz services. We are not using OFBiz to render
the UI. Basically we want to consume all the ecommerce functionality, but do it thru web services so we can build our interface
using PHP.

----- Original Message -----
From: "David E Jones" <[hidden email]>
To: [hidden email]
Sent: Sunday, February 22, 2009 4:51:16 PM (GMT-0700) America/Denver
Subject: Re: Using Axis w/ OFBiz


If you're running in-container, why use web services?

As for the ShoppingCartEvents.getCartObject() method... is the request
you are passing to it in the web session of the user? No, it is in the
web session of the SOAP service...

-David


On Feb 22, 2009, at 12:36 PM, atoner wrote:

>
> Hi.
>
> I am trying to expose services in OFBiz through Axis2 deployed in
> the same
> container. Basically I am trying to use a Symfony front-end to make
> SOAP
> calls to perform functions such as adding an item to a shopping cart
> or
> retrieving shopping cart contents. I am doing this by writing a few
> (what I
> thought would be) simple SOAP services in Axis to accomplish this.
>
> But I am having a lot of problems and haven’t found much in the
> mailing list
> archives or on the forums which helps.
>
> I am able to call the SOAP services, the problem is using the OFBiz
> internals within the services. For instance, calling
> ShoppingCartEvents.getCartObject() always returns a null pointer.
> Perhaps I
> am just looking in the wrong place.
>
> Could anyone steer me in the direction of how I would go about
> creating and
> then adding a product/item to a shopping cart and getting its
> contents?
> This is the current code I have:
>
> public String addItemToCart( String productId )
> {
> MessageContext msgCtx = MessageContext.getCurrentMessageContext();
> HttpServletRequest request = (HttpServletRequest)
> msgCtx.getProperty(
> "transport.http.servletRequest" );
>
> Locale locale = UtilHttp.getLocale(request);
>
> ShoppingCart shoppingCart =
> ShoppingCartEvents.getCartObject( request,
> locale, "USD" );
>
> return (String) shoppingCart.getOrderType();
> }
>
> Thanks!
>
>
> --
> View this message in context: http://www.nabble.com/Using-Axis-w--OFBiz-tp22150583p22150583.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>