How to expose Web Service of OFBiz ?

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

How to expose Web Service of OFBiz ?

Dhruv Datta
Hi Frns,

   I am using "wsimport" tool to read an existing WSDL file of OFBiz
framework and want to generate artifacts. I need these because I am
doing load testing on Web Service and retrieve data like the average
time requierd to obtain the reponse from a webservice.

   So I've following questions:

   1) How to expose the existing WebServices of the OFBiz ?
   2) What meaningful data will these services provide?

 I am trying to expose a Web Service by using following syntax:

E:\WSDL>wsimport -d .
http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL

  And I am getting following error :

warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
allowed in doc/lit for soapbind:body: "cancelScheduledJob"
warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
allowed in doc/lit for soapbind:body: "cancelScheduledJob"
error: Invalid wsdl:operation "cancelScheduledJob": its a
document-literal operation,  message part must refer to a schema
element declaration


Any help would be greatly appreciated.

Thanks in Advance.

Dhruv.
Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

Jacques Le Roux
Administrator
Most is here http://docs.ofbiz.org/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo#FAQ-Tips-Tricks-Cookbook-HowTo-Soap

Jacques

From: "Dhruv Datta" <[hidden email]>

> Hi Frns,
>
>   I am using "wsimport" tool to read an existing WSDL file of OFBiz
> framework and want to generate artifacts. I need these because I am
> doing load testing on Web Service and retrieve data like the average
> time requierd to obtain the reponse from a webservice.
>
>   So I've following questions:
>
>   1) How to expose the existing WebServices of the OFBiz ?
>   2) What meaningful data will these services provide?
>
> I am trying to expose a Web Service by using following syntax:
>
> E:\WSDL>wsimport -d .
> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL
>
>  And I am getting following error :
>
> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
> error: Invalid wsdl:operation "cancelScheduledJob": its a
> document-literal operation,  message part must refer to a schema
> element declaration
>
>
> Any help would be greatly appreciated.
>
> Thanks in Advance.
>
> Dhruv.
>

Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

Alfredo Rueda
In reply to this post by Dhruv Datta
Hello Dhruv!

A collection of Ofbiz services have been exposed as Web Services using this solution:

http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP

These Web Services have been deployed in a production environment and are working perfectly fine.

I suggest you to follow the steps, and I will be glad to help you if you run into trouble at some point in the process.

Once you finish you can create your own Axis2 Ofbiz Component to provide a cleaner solution. This Axis2 Ofbiz Component will serve as a Web Service Facade to comunicate Ofbiz with other systems.

Regards,

Alfredo Rueda

Dhruv Datta wrote
Hi Frns,

   I am using "wsimport" tool to read an existing WSDL file of OFBiz
framework and want to generate artifacts. I need these because I am
doing load testing on Web Service and retrieve data like the average
time requierd to obtain the reponse from a webservice.

   So I've following questions:

   1) How to expose the existing WebServices of the OFBiz ?
   2) What meaningful data will these services provide?

 I am trying to expose a Web Service by using following syntax:

E:\WSDL>wsimport -d .
http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL

  And I am getting following error :

warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
allowed in doc/lit for soapbind:body: "cancelScheduledJob"
warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
allowed in doc/lit for soapbind:body: "cancelScheduledJob"
error: Invalid wsdl:operation "cancelScheduledJob": its a
document-literal operation,  message part must refer to a schema
element declaration


Any help would be greatly appreciated.

Thanks in Advance.

Dhruv.
Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

Jacques Le Roux
Administrator
Hello Alfredo,

Did you create a such Axis2 component ? If yes couls you think about creating a Jira issue and submit a patch ?

Thanks

Jacques

From: "Alfredo Rueda" <[hidden email]>

>
> Hello Dhruv!
>
> A collection of Ofbiz services have been exposed as Web Services using this
> solution:
>
> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP
>
> These Web Services have been deployed in a production environment and are
> working perfectly fine.
>
> I suggest you to follow the steps, and I will be glad to help you if you run
> into trouble at some point in the process.
>
> Once you finish you can create your own Axis2 Ofbiz Component to provide a
> cleaner solution. This Axis2 Ofbiz Component will serve as a Web Service
> Facade to comunicate Ofbiz with other systems.
>
> Regards,
>
> Alfredo Rueda
>
>
> Dhruv Datta wrote:
>>
>> Hi Frns,
>>
>>    I am using "wsimport" tool to read an existing WSDL file of OFBiz
>> framework and want to generate artifacts. I need these because I am
>> doing load testing on Web Service and retrieve data like the average
>> time requierd to obtain the reponse from a webservice.
>>
>>    So I've following questions:
>>
>>    1) How to expose the existing WebServices of the OFBiz ?
>>    2) What meaningful data will these services provide?
>>
>>  I am trying to expose a Web Service by using following syntax:
>>
>> E:\WSDL>wsimport -d .
>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL
>>
>>   And I am getting following error :
>>
>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>> document-literal operation,  message part must refer to a schema
>> element declaration
>>
>>
>> Any help would be greatly appreciated.
>>
>> Thanks in Advance.
>>
>> Dhruv.
>>
>>
>
> --
> View this message in context: http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

Alfredo Rueda
Hello Jacques!

The Axis2 Ofbiz Component is simply an Ofbiz Component that has:

1. Axis2 1.4 Distribution stored in a subdirectory.
2. The Ofbiz build system is connected to Axis2 build system via an Ant build.xml file
3. A java file that is a Web Services Facade to Ofbiz Services that want to be exported.

So, the only code that need to be published is:
1. The java file that is a Web Services Facade to Ofbiz Services that want to be exported.
    This file contains simply a Java Class that has 1 wrapper method for each Ofbiz Service that want to be exported. Axis2 does the job of exporting java methods as WebServices. It's amazing!
2. The build.xml of the component that builds the java file and puts the class file in an specific Axis2 directory

The Ofbiz community may consider to include this ready to use Axis2 Ofbiz component that includes Axis2 Distribution and some Ofbiz Services exported via SOAP as an example of use.

So, in this case the JIRA issue could be an idea more than code changes of existing Ofbiz code?
How can I publish this idea as a JIRA issue?
If the community thinks that is a good idea, then I will be glad to provide an example code (for instance 2 Ofbiz services that use complex types exported via SOAP), the build.xml and the documentation. The example code will be a java file that exports two Ofbiz Services that come with Ofbiz Distribution (now I'm exporting customer specific Ofbiz Services, that is why It's nonsense to publish this java file.)

Regards,

Alfredo






jacques.le.roux wrote
Hello Alfredo,

Did you create a such Axis2 component ? If yes couls you think about creating a Jira issue and submit a patch ?

Thanks

Jacques

From: "Alfredo Rueda" <alfredo.rueda@opentrends.net>
>
> Hello Dhruv!
>
> A collection of Ofbiz services have been exposed as Web Services using this
> solution:
>
> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP
>
> These Web Services have been deployed in a production environment and are
> working perfectly fine.
>
> I suggest you to follow the steps, and I will be glad to help you if you run
> into trouble at some point in the process.
>
> Once you finish you can create your own Axis2 Ofbiz Component to provide a
> cleaner solution. This Axis2 Ofbiz Component will serve as a Web Service
> Facade to comunicate Ofbiz with other systems.
>
> Regards,
>
> Alfredo Rueda
>
>
> Dhruv Datta wrote:
>>
>> Hi Frns,
>>
>>    I am using "wsimport" tool to read an existing WSDL file of OFBiz
>> framework and want to generate artifacts. I need these because I am
>> doing load testing on Web Service and retrieve data like the average
>> time requierd to obtain the reponse from a webservice.
>>
>>    So I've following questions:
>>
>>    1) How to expose the existing WebServices of the OFBiz ?
>>    2) What meaningful data will these services provide?
>>
>>  I am trying to expose a Web Service by using following syntax:
>>
>> E:\WSDL>wsimport -d .
>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL
>>
>>   And I am getting following error :
>>
>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>> document-literal operation,  message part must refer to a schema
>> element declaration
>>
>>
>> Any help would be greatly appreciated.
>>
>> Thanks in Advance.
>>
>> Dhruv.
>>
>>
>
> --
> View this message in context: http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

Vince Clark
Alfredo

So to be clear, you have deployed Axis2 as its own OFBiz component? Or are you still using the approach of deploying the war file under an existing webapp directory in another component?

A patch would be very helpful. Not sure why you think it is "nonsense." Working examples are extremely helpful to the community. Especially in new areas like this.

To submit a patch you must create an account on Jira, then create an issue and attach the patch file.

Looking forward to seeing what you have done!

----- Original Message -----
From: "Alfredo Rueda" <[hidden email]>
To: [hidden email]
Sent: Monday, February 23, 2009 5:17:53 AM (GMT-0700) America/Denver
Subject: Re: How to expose Web Service of OFBiz ?


Hello Jacques!

The Axis2 Ofbiz Component is simply an Ofbiz Component that has:

1. Axis2 1.4 Distribution stored in a subdirectory.
2. The Ofbiz build system is connected to Axis2 build system via an Ant
build.xml file
3. A java file that is a Web Services Facade to Ofbiz Services that want to
be exported.

So, the only code that need to be published is:
1. The java file that is a Web Services Facade to Ofbiz Services that want
to be exported.
This file contains simply a Java Class that has 1 wrapper method for
each Ofbiz Service that want to be exported. Axis2 does the job of exporting
java methods as WebServices. It's amazing!
2. The build.xml of the component that builds the java file and puts the
class file in an specific Axis2 directory

The Ofbiz community may consider to include this ready to use Axis2 Ofbiz
component that includes Axis2 Distribution and some Ofbiz Services exported
via SOAP as an example of use.

So, in this case the JIRA issue could be an idea more than code changes of
existing Ofbiz code?
How can I publish this idea as a JIRA issue?
If the community thinks that is a good idea, then I will be glad to provide
an example code (for instance 2 Ofbiz services that use complex types
exported via SOAP), the build.xml and the documentation. The example code
will be a java file that exports two Ofbiz Services that come with Ofbiz
Distribution (now I'm exporting customer specific Ofbiz Services, that is
why It's nonsense to publish this java file.)

Regards,

Alfredo







jacques.le.roux wrote:

>
> Hello Alfredo,
>
> Did you create a such Axis2 component ? If yes couls you think about
> creating a Jira issue and submit a patch ?
>
> Thanks
>
> Jacques
>
> From: "Alfredo Rueda" <[hidden email]>
>>
>> Hello Dhruv!
>>
>> A collection of Ofbiz services have been exposed as Web Services using
>> this
>> solution:
>>
>> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP 
>>
>> These Web Services have been deployed in a production environment and are
>> working perfectly fine.
>>
>> I suggest you to follow the steps, and I will be glad to help you if you
>> run
>> into trouble at some point in the process.
>>
>> Once you finish you can create your own Axis2 Ofbiz Component to provide
>> a
>> cleaner solution. This Axis2 Ofbiz Component will serve as a Web Service
>> Facade to comunicate Ofbiz with other systems.
>>
>> Regards,
>>
>> Alfredo Rueda
>>
>>
>> Dhruv Datta wrote:
>>>
>>> Hi Frns,
>>>
>>> I am using "wsimport" tool to read an existing WSDL file of OFBiz
>>> framework and want to generate artifacts. I need these because I am
>>> doing load testing on Web Service and retrieve data like the average
>>> time requierd to obtain the reponse from a webservice.
>>>
>>> So I've following questions:
>>>
>>> 1) How to expose the existing WebServices of the OFBiz ?
>>> 2) What meaningful data will these services provide?
>>>
>>> I am trying to expose a Web Service by using following syntax:
>>>
>>> E:\WSDL>wsimport -d .
>>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL 
>>>
>>> And I am getting following error :
>>>
>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>>> document-literal operation, message part must refer to a schema
>>> element declaration
>>>
>>>
>>> Any help would be greatly appreciated.
>>>
>>> Thanks in Advance.
>>>
>>> Dhruv.
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html 
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>
>
>

--
View this message in context: http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22160487.html 
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

Alfredo Rueda
Hello Vince,

Yes, I have deployed Axis2 as its own OFBiz component.

"The example code
will be a java file that exports two Ofbiz Services that come with Ofbiz
Distribution (now I'm exporting customer specific Ofbiz Services, that is
why it's nonsense to publish this java file.)"

I meant that it's nonsense to publish an example in which I export customer specific ofbiz services, because I have to provide also a lot of code that the customer specific ofbiz service relies on, for instance, ofbiz service minilang implementation, lot of subservices, views entities, etc, etc, etc.

The purpose is just to show how to export ofbiz services that use complex type parameters, so why not use as an example standard ofbiz services that comes with Ofbiz Distribution? This was the only thing I tried to explain before :-)

Regards,

Alfredo




Vince Clark wrote
Alfredo

So to be clear, you have deployed Axis2 as its own OFBiz component? Or are you still using the approach of deploying the war file under an existing webapp directory in another component?

A patch would be very helpful. Not sure why you think it is "nonsense." Working examples are extremely helpful to the community. Especially in new areas like this.

To submit a patch you must create an account on Jira, then create an issue and attach the patch file.

Looking forward to seeing what you have done!

----- Original Message -----
From: "Alfredo Rueda" <alfredo.rueda@opentrends.net> 
To: user@ofbiz.apache.org
Sent: Monday, February 23, 2009 5:17:53 AM (GMT-0700) America/Denver
Subject: Re: How to expose Web Service of OFBiz ?


Hello Jacques!

The Axis2 Ofbiz Component is simply an Ofbiz Component that has:

1. Axis2 1.4 Distribution stored in a subdirectory.
2. The Ofbiz build system is connected to Axis2 build system via an Ant
build.xml file
3. A java file that is a Web Services Facade to Ofbiz Services that want to
be exported.

So, the only code that need to be published is:
1. The java file that is a Web Services Facade to Ofbiz Services that want
to be exported.
This file contains simply a Java Class that has 1 wrapper method for
each Ofbiz Service that want to be exported. Axis2 does the job of exporting
java methods as WebServices. It's amazing!
2. The build.xml of the component that builds the java file and puts the
class file in an specific Axis2 directory

The Ofbiz community may consider to include this ready to use Axis2 Ofbiz
component that includes Axis2 Distribution and some Ofbiz Services exported
via SOAP as an example of use.

So, in this case the JIRA issue could be an idea more than code changes of
existing Ofbiz code?
How can I publish this idea as a JIRA issue?
If the community thinks that is a good idea, then I will be glad to provide
an example code (for instance 2 Ofbiz services that use complex types
exported via SOAP), the build.xml and the documentation. The example code
will be a java file that exports two Ofbiz Services that come with Ofbiz
Distribution (now I'm exporting customer specific Ofbiz Services, that is
why It's nonsense to publish this java file.)

Regards,

Alfredo







jacques.le.roux wrote:
>
> Hello Alfredo,
>
> Did you create a such Axis2 component ? If yes couls you think about
> creating a Jira issue and submit a patch ?
>
> Thanks
>
> Jacques
>
> From: "Alfredo Rueda" <alfredo.rueda@opentrends.net> 
>>
>> Hello Dhruv!
>>
>> A collection of Ofbiz services have been exposed as Web Services using
>> this
>> solution:
>>
>> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP 
>>
>> These Web Services have been deployed in a production environment and are
>> working perfectly fine.
>>
>> I suggest you to follow the steps, and I will be glad to help you if you
>> run
>> into trouble at some point in the process.
>>
>> Once you finish you can create your own Axis2 Ofbiz Component to provide
>> a
>> cleaner solution. This Axis2 Ofbiz Component will serve as a Web Service
>> Facade to comunicate Ofbiz with other systems.
>>
>> Regards,
>>
>> Alfredo Rueda
>>
>>
>> Dhruv Datta wrote:
>>>
>>> Hi Frns,
>>>
>>> I am using "wsimport" tool to read an existing WSDL file of OFBiz
>>> framework and want to generate artifacts. I need these because I am
>>> doing load testing on Web Service and retrieve data like the average
>>> time requierd to obtain the reponse from a webservice.
>>>
>>> So I've following questions:
>>>
>>> 1) How to expose the existing WebServices of the OFBiz ?
>>> 2) What meaningful data will these services provide?
>>>
>>> I am trying to expose a Web Service by using following syntax:
>>>
>>> E:\WSDL>wsimport -d .
>>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL 
>>>
>>> And I am getting following error :
>>>
>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>>> document-literal operation, message part must refer to a schema
>>> element declaration
>>>
>>>
>>> Any help would be greatly appreciated.
>>>
>>> Thanks in Advance.
>>>
>>> Dhruv.
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html 
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>
>
>

--
View this message in context: http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22160487.html 
Sent from the OFBiz - User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

Vince Clark
OK that makes sense. Yes I agree it would not make sense to publish custom services you have written for a customer. But examples of OFBiz standard services being exported would be very helpful, along with the directory structure, supporting files, etc. for deploying as an OFBiz component. For example, did you deploy the entire binary distribution, or just axis2.war?

A jira issue that explains your solution along with a patch would be fantastic! Before doing that, would you mind just replying to this thread with a code sample showing the call to a standard OFBiz service and how you are dealing with the results? It would be very timely as we are struggling with this very thing right now.

----- Original Message -----
From: "Alfredo Rueda" <[hidden email]>
To: [hidden email]
Sent: Monday, February 23, 2009 8:23:39 AM (GMT-0700) America/Denver
Subject: Re: How to expose Web Service of OFBiz ?


Hello Vince,

Yes, I have deployed Axis2 as its own OFBiz component.

"The example code
will be a java file that exports two Ofbiz Services that come with Ofbiz
Distribution (now I'm exporting customer specific Ofbiz Services, that is
why it's nonsense to publish this java file.)"

I meant that it's nonsense to publish an example in which I export customer
specific ofbiz services, because I have to provide also a lot of code that
the customer specific ofbiz service relies on, for instance, ofbiz service
minilang implementation, lot of subservices, views entities, etc, etc, etc.

The purpose is just to show how to export ofbiz services that use complex
type parameters, so why not use as an example standard ofbiz services that
comes with Ofbiz Distribution? This was the only thing I tried to explain
before :-)

Regards,

Alfredo





Vince Clark wrote:

>
> Alfredo
>
> So to be clear, you have deployed Axis2 as its own OFBiz component? Or are
> you still using the approach of deploying the war file under an existing
> webapp directory in another component?
>
> A patch would be very helpful. Not sure why you think it is "nonsense."
> Working examples are extremely helpful to the community. Especially in new
> areas like this.
>
> To submit a patch you must create an account on Jira, then create an issue
> and attach the patch file.
>
> Looking forward to seeing what you have done!
>
> ----- Original Message -----
> From: "Alfredo Rueda" <[hidden email]>
> To: [hidden email]
> Sent: Monday, February 23, 2009 5:17:53 AM (GMT-0700) America/Denver
> Subject: Re: How to expose Web Service of OFBiz ?
>
>
> Hello Jacques!
>
> The Axis2 Ofbiz Component is simply an Ofbiz Component that has:
>
> 1. Axis2 1.4 Distribution stored in a subdirectory.
> 2. The Ofbiz build system is connected to Axis2 build system via an Ant
> build.xml file
> 3. A java file that is a Web Services Facade to Ofbiz Services that want
> to
> be exported.
>
> So, the only code that need to be published is:
> 1. The java file that is a Web Services Facade to Ofbiz Services that want
> to be exported.
> This file contains simply a Java Class that has 1 wrapper method for
> each Ofbiz Service that want to be exported. Axis2 does the job of
> exporting
> java methods as WebServices. It's amazing!
> 2. The build.xml of the component that builds the java file and puts the
> class file in an specific Axis2 directory
>
> The Ofbiz community may consider to include this ready to use Axis2 Ofbiz
> component that includes Axis2 Distribution and some Ofbiz Services
> exported
> via SOAP as an example of use.
>
> So, in this case the JIRA issue could be an idea more than code changes of
> existing Ofbiz code?
> How can I publish this idea as a JIRA issue?
> If the community thinks that is a good idea, then I will be glad to
> provide
> an example code (for instance 2 Ofbiz services that use complex types
> exported via SOAP), the build.xml and the documentation. The example code
> will be a java file that exports two Ofbiz Services that come with Ofbiz
> Distribution (now I'm exporting customer specific Ofbiz Services, that is
> why It's nonsense to publish this java file.)
>
> Regards,
>
> Alfredo
>
>
>
>
>
>
>
> jacques.le.roux wrote:
>>
>> Hello Alfredo,
>>
>> Did you create a such Axis2 component ? If yes couls you think about
>> creating a Jira issue and submit a patch ?
>>
>> Thanks
>>
>> Jacques
>>
>> From: "Alfredo Rueda" <[hidden email]>
>>>
>>> Hello Dhruv!
>>>
>>> A collection of Ofbiz services have been exposed as Web Services using
>>> this
>>> solution:
>>>
>>> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP 
>>>
>>> These Web Services have been deployed in a production environment and
>>> are
>>> working perfectly fine.
>>>
>>> I suggest you to follow the steps, and I will be glad to help you if you
>>> run
>>> into trouble at some point in the process.
>>>
>>> Once you finish you can create your own Axis2 Ofbiz Component to provide
>>> a
>>> cleaner solution. This Axis2 Ofbiz Component will serve as a Web Service
>>> Facade to comunicate Ofbiz with other systems.
>>>
>>> Regards,
>>>
>>> Alfredo Rueda
>>>
>>>
>>> Dhruv Datta wrote:
>>>>
>>>> Hi Frns,
>>>>
>>>> I am using "wsimport" tool to read an existing WSDL file of OFBiz
>>>> framework and want to generate artifacts. I need these because I am
>>>> doing load testing on Web Service and retrieve data like the average
>>>> time requierd to obtain the reponse from a webservice.
>>>>
>>>> So I've following questions:
>>>>
>>>> 1) How to expose the existing WebServices of the OFBiz ?
>>>> 2) What meaningful data will these services provide?
>>>>
>>>> I am trying to expose a Web Service by using following syntax:
>>>>
>>>> E:\WSDL>wsimport -d .
>>>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL 
>>>>
>>>> And I am getting following error :
>>>>
>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>>>> document-literal operation, message part must refer to a schema
>>>> element declaration
>>>>
>>>>
>>>> Any help would be greatly appreciated.
>>>>
>>>> Thanks in Advance.
>>>>
>>>> Dhruv.
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html 
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22160487.html 
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>
>

--
View this message in context: http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22163567.html 
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

Alfredo Rueda
This post was updated on .
OK, I will be glad to help you, but please could you suggest me which Ofbiz service you want to export?
I'm working with OpenTaps, so I don't know If OpenTaps will also have your ofbiz service included in their distro (OpenTaps is built upon Ofbiz??)

Some example:

                GenericDelegator delegator = GenericDelegator.getGenericDelegator("default");
                LocalDispatcher dispatcher = GenericDispatcher.getLocalDispatcher("default",delegator);
                GenericValue admin = null;
                try {
                        admin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "admin"));
                } catch (GenericEntityException e1) {
                        e1.printStackTrace();
                }
               
                Map result = null;

                Object[] params = {
                                "login.username", un_username,
                                "login.password", un_password,
                                "domini", un_domini,
                                .... (more params)

                                "estat", un_estat,
                                "ip", una_ip,
                                "userLogin", admin
                };
               
                try {
                        result = dispatcher.runSync("put here the name of your ofbiz service",
                                                                                UtilMisc.toMap(params));
                } catch (GenericServiceException e) {
                        e.printStackTrace();
                }
               
                // Now get the result using result variable
               

Hope that helps!


Vince Clark wrote
OK that makes sense. Yes I agree it would not make sense to publish custom services you have written for a customer. But examples of OFBiz standard services being exported would be very helpful, along with the directory structure, supporting files, etc. for deploying as an OFBiz component. For example, did you deploy the entire binary distribution, or just axis2.war?

A jira issue that explains your solution along with a patch would be fantastic! Before doing that, would you mind just replying to this thread with a code sample showing the call to a standard OFBiz service and how you are dealing with the results? It would be very timely as we are struggling with this very thing right now.

----- Original Message -----
From: "Alfredo Rueda" <alfredo.rueda@opentrends.net> 
To: user@ofbiz.apache.org
Sent: Monday, February 23, 2009 8:23:39 AM (GMT-0700) America/Denver
Subject: Re: How to expose Web Service of OFBiz ?


Hello Vince,

Yes, I have deployed Axis2 as its own OFBiz component.

"The example code
will be a java file that exports two Ofbiz Services that come with Ofbiz
Distribution (now I'm exporting customer specific Ofbiz Services, that is
why it's nonsense to publish this java file.)"

I meant that it's nonsense to publish an example in which I export customer
specific ofbiz services, because I have to provide also a lot of code that
the customer specific ofbiz service relies on, for instance, ofbiz service
minilang implementation, lot of subservices, views entities, etc, etc, etc.

The purpose is just to show how to export ofbiz services that use complex
type parameters, so why not use as an example standard ofbiz services that
comes with Ofbiz Distribution? This was the only thing I tried to explain
before :-)

Regards,

Alfredo





Vince Clark wrote:
>
> Alfredo
>
> So to be clear, you have deployed Axis2 as its own OFBiz component? Or are
> you still using the approach of deploying the war file under an existing
> webapp directory in another component?
>
> A patch would be very helpful. Not sure why you think it is "nonsense."
> Working examples are extremely helpful to the community. Especially in new
> areas like this.
>
> To submit a patch you must create an account on Jira, then create an issue
> and attach the patch file.
>
> Looking forward to seeing what you have done!
>
> ----- Original Message -----
> From: "Alfredo Rueda" <alfredo.rueda@opentrends.net> 
> To: user@ofbiz.apache.org
> Sent: Monday, February 23, 2009 5:17:53 AM (GMT-0700) America/Denver
> Subject: Re: How to expose Web Service of OFBiz ?
>
>
> Hello Jacques!
>
> The Axis2 Ofbiz Component is simply an Ofbiz Component that has:
>
> 1. Axis2 1.4 Distribution stored in a subdirectory.
> 2. The Ofbiz build system is connected to Axis2 build system via an Ant
> build.xml file
> 3. A java file that is a Web Services Facade to Ofbiz Services that want
> to
> be exported.
>
> So, the only code that need to be published is:
> 1. The java file that is a Web Services Facade to Ofbiz Services that want
> to be exported.
> This file contains simply a Java Class that has 1 wrapper method for
> each Ofbiz Service that want to be exported. Axis2 does the job of
> exporting
> java methods as WebServices. It's amazing!
> 2. The build.xml of the component that builds the java file and puts the
> class file in an specific Axis2 directory
>
> The Ofbiz community may consider to include this ready to use Axis2 Ofbiz
> component that includes Axis2 Distribution and some Ofbiz Services
> exported
> via SOAP as an example of use.
>
> So, in this case the JIRA issue could be an idea more than code changes of
> existing Ofbiz code?
> How can I publish this idea as a JIRA issue?
> If the community thinks that is a good idea, then I will be glad to
> provide
> an example code (for instance 2 Ofbiz services that use complex types
> exported via SOAP), the build.xml and the documentation. The example code
> will be a java file that exports two Ofbiz Services that come with Ofbiz
> Distribution (now I'm exporting customer specific Ofbiz Services, that is
> why It's nonsense to publish this java file.)
>
> Regards,
>
> Alfredo
>
>
>
>
>
>
>
> jacques.le.roux wrote:
>>
>> Hello Alfredo,
>>
>> Did you create a such Axis2 component ? If yes couls you think about
>> creating a Jira issue and submit a patch ?
>>
>> Thanks
>>
>> Jacques
>>
>> From: "Alfredo Rueda" <alfredo.rueda@opentrends.net> 
>>>
>>> Hello Dhruv!
>>>
>>> A collection of Ofbiz services have been exposed as Web Services using
>>> this
>>> solution:
>>>
>>> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP 
>>>
>>> These Web Services have been deployed in a production environment and
>>> are
>>> working perfectly fine.
>>>
>>> I suggest you to follow the steps, and I will be glad to help you if you
>>> run
>>> into trouble at some point in the process.
>>>
>>> Once you finish you can create your own Axis2 Ofbiz Component to provide
>>> a
>>> cleaner solution. This Axis2 Ofbiz Component will serve as a Web Service
>>> Facade to comunicate Ofbiz with other systems.
>>>
>>> Regards,
>>>
>>> Alfredo Rueda
>>>
>>>
>>> Dhruv Datta wrote:
>>>>
>>>> Hi Frns,
>>>>
>>>> I am using "wsimport" tool to read an existing WSDL file of OFBiz
>>>> framework and want to generate artifacts. I need these because I am
>>>> doing load testing on Web Service and retrieve data like the average
>>>> time requierd to obtain the reponse from a webservice.
>>>>
>>>> So I've following questions:
>>>>
>>>> 1) How to expose the existing WebServices of the OFBiz ?
>>>> 2) What meaningful data will these services provide?
>>>>
>>>> I am trying to expose a Web Service by using following syntax:
>>>>
>>>> E:\WSDL>wsimport -d .
>>>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL 
>>>>
>>>> And I am getting following error :
>>>>
>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>>>> document-literal operation, message part must refer to a schema
>>>> element declaration
>>>>
>>>>
>>>> Any help would be greatly appreciated.
>>>>
>>>> Thanks in Advance.
>>>>
>>>> Dhruv.
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html 
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22160487.html 
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>
>

--
View this message in context: http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22163567.html 
Sent from the OFBiz - User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

Vince Clark
This helps, thank you. Your example goes further than the one in the how to.

Could you shed some light on this scenario? We want to use all the shopping cart functionality and are struggling with how to put all the pieces together.
If I use OFBiz ecommerce as a guide and trace thru the code I see that from the ecommerce site if I click "add to cart" it calls a request map called "additem" in the controller.
That request map calls the following event:
<event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="addToCart"/>
which is not defined as a service. So we are a bit confused as to how we can mimick the shopping cart functionality thru web services.
Should we call ShoppingCartEvents.addToCart() directly from our java class in Axis, and then use other methods defined as services, such as ShoppingCartServices.getShoppingCartData() to return up the stack?

----- Original Message -----
From: "Alfredo Rueda" <[hidden email]>
To: [hidden email]
Sent: Monday, February 23, 2009 8:50:22 AM (GMT-0700) America/Denver
Subject: Re: How to expose Web Service of OFBiz ?


OK, I will be glad to help you, but please could you suggest me which Ofbiz
service you want to export?
I'm working with OpenTaps, so I don't know If OpenTaps will also have your
web service included in their distro (OpenTaps is built upon Ofbiz??)

Some example:

GenericDelegator delegator =
GenericDelegator.getGenericDelegator("default");
LocalDispatcher dispatcher =
GenericDispatcher.getLocalDispatcher("default",delegator);
GenericValue admin = null;
try {
admin = delegator.findByPrimaryKey("UserLogin",
UtilMisc.toMap("userLoginId", "admin"));
} catch (GenericEntityException e1) {
e1.printStackTrace();
}

Map result = null;

Object[] params = {
"login.username", un_username,
"login.password", un_password,
"domini", un_domini,
.... (more params)

"estat", un_estat,
"ip", una_ip,
"userLogin", admin
};

try {
result = dispatcher.runSync("put here the name of your ofbiz service",
UtilMisc.toMap(params));
} catch (GenericServiceException e) {
e.printStackTrace();
}

// Now get the result using result variable


Hope that helps!



Vince Clark wrote:

>
> OK that makes sense. Yes I agree it would not make sense to publish custom
> services you have written for a customer. But examples of OFBiz standard
> services being exported would be very helpful, along with the directory
> structure, supporting files, etc. for deploying as an OFBiz component. For
> example, did you deploy the entire binary distribution, or just axis2.war?
>
> A jira issue that explains your solution along with a patch would be
> fantastic! Before doing that, would you mind just replying to this thread
> with a code sample showing the call to a standard OFBiz service and how
> you are dealing with the results? It would be very timely as we are
> struggling with this very thing right now.
>
> ----- Original Message -----
> From: "Alfredo Rueda" <[hidden email]>
> To: [hidden email]
> Sent: Monday, February 23, 2009 8:23:39 AM (GMT-0700) America/Denver
> Subject: Re: How to expose Web Service of OFBiz ?
>
>
> Hello Vince,
>
> Yes, I have deployed Axis2 as its own OFBiz component.
>
> "The example code
> will be a java file that exports two Ofbiz Services that come with Ofbiz
> Distribution (now I'm exporting customer specific Ofbiz Services, that is
> why it's nonsense to publish this java file.)"
>
> I meant that it's nonsense to publish an example in which I export
> customer
> specific ofbiz services, because I have to provide also a lot of code that
> the customer specific ofbiz service relies on, for instance, ofbiz service
> minilang implementation, lot of subservices, views entities, etc, etc,
> etc.
>
> The purpose is just to show how to export ofbiz services that use complex
> type parameters, so why not use as an example standard ofbiz services that
> comes with Ofbiz Distribution? This was the only thing I tried to explain
> before :-)
>
> Regards,
>
> Alfredo
>
>
>
>
>
> Vince Clark wrote:
>>
>> Alfredo
>>
>> So to be clear, you have deployed Axis2 as its own OFBiz component? Or
>> are
>> you still using the approach of deploying the war file under an existing
>> webapp directory in another component?
>>
>> A patch would be very helpful. Not sure why you think it is "nonsense."
>> Working examples are extremely helpful to the community. Especially in
>> new
>> areas like this.
>>
>> To submit a patch you must create an account on Jira, then create an
>> issue
>> and attach the patch file.
>>
>> Looking forward to seeing what you have done!
>>
>> ----- Original Message -----
>> From: "Alfredo Rueda" <[hidden email]>
>> To: [hidden email]
>> Sent: Monday, February 23, 2009 5:17:53 AM (GMT-0700) America/Denver
>> Subject: Re: How to expose Web Service of OFBiz ?
>>
>>
>> Hello Jacques!
>>
>> The Axis2 Ofbiz Component is simply an Ofbiz Component that has:
>>
>> 1. Axis2 1.4 Distribution stored in a subdirectory.
>> 2. The Ofbiz build system is connected to Axis2 build system via an Ant
>> build.xml file
>> 3. A java file that is a Web Services Facade to Ofbiz Services that want
>> to
>> be exported.
>>
>> So, the only code that need to be published is:
>> 1. The java file that is a Web Services Facade to Ofbiz Services that
>> want
>> to be exported.
>> This file contains simply a Java Class that has 1 wrapper method for
>> each Ofbiz Service that want to be exported. Axis2 does the job of
>> exporting
>> java methods as WebServices. It's amazing!
>> 2. The build.xml of the component that builds the java file and puts the
>> class file in an specific Axis2 directory
>>
>> The Ofbiz community may consider to include this ready to use Axis2 Ofbiz
>> component that includes Axis2 Distribution and some Ofbiz Services
>> exported
>> via SOAP as an example of use.
>>
>> So, in this case the JIRA issue could be an idea more than code changes
>> of
>> existing Ofbiz code?
>> How can I publish this idea as a JIRA issue?
>> If the community thinks that is a good idea, then I will be glad to
>> provide
>> an example code (for instance 2 Ofbiz services that use complex types
>> exported via SOAP), the build.xml and the documentation. The example code
>> will be a java file that exports two Ofbiz Services that come with Ofbiz
>> Distribution (now I'm exporting customer specific Ofbiz Services, that is
>> why It's nonsense to publish this java file.)
>>
>> Regards,
>>
>> Alfredo
>>
>>
>>
>>
>>
>>
>>
>> jacques.le.roux wrote:
>>>
>>> Hello Alfredo,
>>>
>>> Did you create a such Axis2 component ? If yes couls you think about
>>> creating a Jira issue and submit a patch ?
>>>
>>> Thanks
>>>
>>> Jacques
>>>
>>> From: "Alfredo Rueda" <[hidden email]>
>>>>
>>>> Hello Dhruv!
>>>>
>>>> A collection of Ofbiz services have been exposed as Web Services using
>>>> this
>>>> solution:
>>>>
>>>> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP 
>>>>
>>>> These Web Services have been deployed in a production environment and
>>>> are
>>>> working perfectly fine.
>>>>
>>>> I suggest you to follow the steps, and I will be glad to help you if
>>>> you
>>>> run
>>>> into trouble at some point in the process.
>>>>
>>>> Once you finish you can create your own Axis2 Ofbiz Component to
>>>> provide
>>>> a
>>>> cleaner solution. This Axis2 Ofbiz Component will serve as a Web
>>>> Service
>>>> Facade to comunicate Ofbiz with other systems.
>>>>
>>>> Regards,
>>>>
>>>> Alfredo Rueda
>>>>
>>>>
>>>> Dhruv Datta wrote:
>>>>>
>>>>> Hi Frns,
>>>>>
>>>>> I am using "wsimport" tool to read an existing WSDL file of OFBiz
>>>>> framework and want to generate artifacts. I need these because I am
>>>>> doing load testing on Web Service and retrieve data like the average
>>>>> time requierd to obtain the reponse from a webservice.
>>>>>
>>>>> So I've following questions:
>>>>>
>>>>> 1) How to expose the existing WebServices of the OFBiz ?
>>>>> 2) What meaningful data will these services provide?
>>>>>
>>>>> I am trying to expose a Web Service by using following syntax:
>>>>>
>>>>> E:\WSDL>wsimport -d .
>>>>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL 
>>>>>
>>>>> And I am getting following error :
>>>>>
>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>>>>> document-literal operation, message part must refer to a schema
>>>>> element declaration
>>>>>
>>>>>
>>>>> Any help would be greatly appreciated.
>>>>>
>>>>> Thanks in Advance.
>>>>>
>>>>> Dhruv.
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html 
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22160487.html 
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22163567.html 
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>
>

--
View this message in context: http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22164077.html 
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

Jacques Le Roux
Administrator
In reply to this post by Alfredo Rueda
From: "Alfredo Rueda" <[hidden email]>

>
> Hello Jacques!
>
> The Axis2 Ofbiz Component is simply an Ofbiz Component that has:
>
> 1. Axis2 1.4 Distribution stored in a subdirectory.
> 2. The Ofbiz build system is connected to Axis2 build system via an Ant
> build.xml file
> 3. A java file that is a Web Services Facade to Ofbiz Services that want to
> be exported.
>
> So, the only code that need to be published is:
> 1. The java file that is a Web Services Facade to Ofbiz Services that want
> to be exported.
>    This file contains simply a Java Class that has 1 wrapper method for
> each Ofbiz Service that want to be exported. Axis2 does the job of exporting
> java methods as WebServices. It's amazing!
> 2. The build.xml of the component that builds the java file and puts the
> class file in an specific Axis2 directory
>
> The Ofbiz community may consider to include this ready to use Axis2 Ofbiz
> component that includes Axis2 Distribution and some Ofbiz Services exported
> via SOAP as an example of use.
>
> So, in this case the JIRA issue could be an idea more than code changes of
> existing Ofbiz code?
> How can I publish this idea as a JIRA issue?
> If the community thinks that is a good idea, then I will be glad to provide
> an example code (for instance 2 Ofbiz services that use complex types
> exported via SOAP), the build.xml and the documentation. The example code
> will be a java file that exports two Ofbiz Services that come with Ofbiz
> Distribution (now I'm exporting customer specific Ofbiz Services, that is
> why It's nonsense to publish this java file.)
>
> Regards,

Hi Alfredo,

Sorry a bit late, I was half ill these last days...
Yes I think it's interesting to have something like that OOTB. Could you please follow
http://docs.ofbiz.org/display/OFBADMIN/OFBiz+Contributors+Best+Practices to create a Jira issue and submit a patch.
I'm still unsure where we should put the java and ant files. We could use the same scheme than for external appservers and put them
under a framework/soap/axis2 directory as maybe other tools like Axis could be used later (if the ESB world does not replace all
that before...)
For the services, you could use an example service from ExampleServices.xml if you find enough matter there (mmm.. there are not
much complex types in Examples entities). Anyway there are enough services in OFBiz to make your choice ... ;o)

Thanks

Jacques

> Alfredo
>
>
>
>
>
>
>
> jacques.le.roux wrote:
>>
>> Hello Alfredo,
>>
>> Did you create a such Axis2 component ? If yes couls you think about
>> creating a Jira issue and submit a patch ?
>>
>> Thanks
>>
>> Jacques
>>
>> From: "Alfredo Rueda" <[hidden email]>
>>>
>>> Hello Dhruv!
>>>
>>> A collection of Ofbiz services have been exposed as Web Services using
>>> this
>>> solution:
>>>
>>> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP
>>>
>>> These Web Services have been deployed in a production environment and are
>>> working perfectly fine.
>>>
>>> I suggest you to follow the steps, and I will be glad to help you if you
>>> run
>>> into trouble at some point in the process.
>>>
>>> Once you finish you can create your own Axis2 Ofbiz Component to provide
>>> a
>>> cleaner solution. This Axis2 Ofbiz Component will serve as a Web Service
>>> Facade to comunicate Ofbiz with other systems.
>>>
>>> Regards,
>>>
>>> Alfredo Rueda
>>>
>>>
>>> Dhruv Datta wrote:
>>>>
>>>> Hi Frns,
>>>>
>>>>    I am using "wsimport" tool to read an existing WSDL file of OFBiz
>>>> framework and want to generate artifacts. I need these because I am
>>>> doing load testing on Web Service and retrieve data like the average
>>>> time requierd to obtain the reponse from a webservice.
>>>>
>>>>    So I've following questions:
>>>>
>>>>    1) How to expose the existing WebServices of the OFBiz ?
>>>>    2) What meaningful data will these services provide?
>>>>
>>>>  I am trying to expose a Web Service by using following syntax:
>>>>
>>>> E:\WSDL>wsimport -d .
>>>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL
>>>>
>>>>   And I am getting following error :
>>>>
>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>>>> document-literal operation,  message part must refer to a schema
>>>> element declaration
>>>>
>>>>
>>>> Any help would be greatly appreciated.
>>>>
>>>> Thanks in Advance.
>>>>
>>>> Dhruv.
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22160487.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

Jacques Le Roux
Administrator
In reply to this post by Vince Clark
Why not create cover services around events if it's your problem ? (Not sure someone did not already suggest this to you, was half
somewhere else those last days...)

Jacques

From: "Vince M. Clark" <[hidden email]>

> This helps, thank you. Your example goes further than the one in the how to.
>
> Could you shed some light on this scenario? We want to use all the shopping cart functionality and are struggling with how to put
> all the pieces together.
> If I use OFBiz ecommerce as a guide and trace thru the code I see that from the ecommerce site if I click "add to cart" it calls a
> request map called "additem" in the controller.
> That request map calls the following event:
> <event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="addToCart"/>
> which is not defined as a service. So we are a bit confused as to how we can mimick the shopping cart functionality thru web
> services.
> Should we call ShoppingCartEvents.addToCart() directly from our java class in Axis, and then use other methods defined as
> services, such as ShoppingCartServices.getShoppingCartData() to return up the stack?
>
> ----- Original Message -----
> From: "Alfredo Rueda" <[hidden email]>
> To: [hidden email]
> Sent: Monday, February 23, 2009 8:50:22 AM (GMT-0700) America/Denver
> Subject: Re: How to expose Web Service of OFBiz ?
>
>
> OK, I will be glad to help you, but please could you suggest me which Ofbiz
> service you want to export?
> I'm working with OpenTaps, so I don't know If OpenTaps will also have your
> web service included in their distro (OpenTaps is built upon Ofbiz??)
>
> Some example:
>
> GenericDelegator delegator =
> GenericDelegator.getGenericDelegator("default");
> LocalDispatcher dispatcher =
> GenericDispatcher.getLocalDispatcher("default",delegator);
> GenericValue admin = null;
> try {
> admin = delegator.findByPrimaryKey("UserLogin",
> UtilMisc.toMap("userLoginId", "admin"));
> } catch (GenericEntityException e1) {
> e1.printStackTrace();
> }
>
> Map result = null;
>
> Object[] params = {
> "login.username", un_username,
> "login.password", un_password,
> "domini", un_domini,
> .... (more params)
>
> "estat", un_estat,
> "ip", una_ip,
> "userLogin", admin
> };
>
> try {
> result = dispatcher.runSync("put here the name of your ofbiz service",
> UtilMisc.toMap(params));
> } catch (GenericServiceException e) {
> e.printStackTrace();
> }
>
> // Now get the result using result variable
>
>
> Hope that helps!
>
>
>
> Vince Clark wrote:
>>
>> OK that makes sense. Yes I agree it would not make sense to publish custom
>> services you have written for a customer. But examples of OFBiz standard
>> services being exported would be very helpful, along with the directory
>> structure, supporting files, etc. for deploying as an OFBiz component. For
>> example, did you deploy the entire binary distribution, or just axis2.war?
>>
>> A jira issue that explains your solution along with a patch would be
>> fantastic! Before doing that, would you mind just replying to this thread
>> with a code sample showing the call to a standard OFBiz service and how
>> you are dealing with the results? It would be very timely as we are
>> struggling with this very thing right now.
>>
>> ----- Original Message -----
>> From: "Alfredo Rueda" <[hidden email]>
>> To: [hidden email]
>> Sent: Monday, February 23, 2009 8:23:39 AM (GMT-0700) America/Denver
>> Subject: Re: How to expose Web Service of OFBiz ?
>>
>>
>> Hello Vince,
>>
>> Yes, I have deployed Axis2 as its own OFBiz component.
>>
>> "The example code
>> will be a java file that exports two Ofbiz Services that come with Ofbiz
>> Distribution (now I'm exporting customer specific Ofbiz Services, that is
>> why it's nonsense to publish this java file.)"
>>
>> I meant that it's nonsense to publish an example in which I export
>> customer
>> specific ofbiz services, because I have to provide also a lot of code that
>> the customer specific ofbiz service relies on, for instance, ofbiz service
>> minilang implementation, lot of subservices, views entities, etc, etc,
>> etc.
>>
>> The purpose is just to show how to export ofbiz services that use complex
>> type parameters, so why not use as an example standard ofbiz services that
>> comes with Ofbiz Distribution? This was the only thing I tried to explain
>> before :-)
>>
>> Regards,
>>
>> Alfredo
>>
>>
>>
>>
>>
>> Vince Clark wrote:
>>>
>>> Alfredo
>>>
>>> So to be clear, you have deployed Axis2 as its own OFBiz component? Or
>>> are
>>> you still using the approach of deploying the war file under an existing
>>> webapp directory in another component?
>>>
>>> A patch would be very helpful. Not sure why you think it is "nonsense."
>>> Working examples are extremely helpful to the community. Especially in
>>> new
>>> areas like this.
>>>
>>> To submit a patch you must create an account on Jira, then create an
>>> issue
>>> and attach the patch file.
>>>
>>> Looking forward to seeing what you have done!
>>>
>>> ----- Original Message -----
>>> From: "Alfredo Rueda" <[hidden email]>
>>> To: [hidden email]
>>> Sent: Monday, February 23, 2009 5:17:53 AM (GMT-0700) America/Denver
>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>
>>>
>>> Hello Jacques!
>>>
>>> The Axis2 Ofbiz Component is simply an Ofbiz Component that has:
>>>
>>> 1. Axis2 1.4 Distribution stored in a subdirectory.
>>> 2. The Ofbiz build system is connected to Axis2 build system via an Ant
>>> build.xml file
>>> 3. A java file that is a Web Services Facade to Ofbiz Services that want
>>> to
>>> be exported.
>>>
>>> So, the only code that need to be published is:
>>> 1. The java file that is a Web Services Facade to Ofbiz Services that
>>> want
>>> to be exported.
>>> This file contains simply a Java Class that has 1 wrapper method for
>>> each Ofbiz Service that want to be exported. Axis2 does the job of
>>> exporting
>>> java methods as WebServices. It's amazing!
>>> 2. The build.xml of the component that builds the java file and puts the
>>> class file in an specific Axis2 directory
>>>
>>> The Ofbiz community may consider to include this ready to use Axis2 Ofbiz
>>> component that includes Axis2 Distribution and some Ofbiz Services
>>> exported
>>> via SOAP as an example of use.
>>>
>>> So, in this case the JIRA issue could be an idea more than code changes
>>> of
>>> existing Ofbiz code?
>>> How can I publish this idea as a JIRA issue?
>>> If the community thinks that is a good idea, then I will be glad to
>>> provide
>>> an example code (for instance 2 Ofbiz services that use complex types
>>> exported via SOAP), the build.xml and the documentation. The example code
>>> will be a java file that exports two Ofbiz Services that come with Ofbiz
>>> Distribution (now I'm exporting customer specific Ofbiz Services, that is
>>> why It's nonsense to publish this java file.)
>>>
>>> Regards,
>>>
>>> Alfredo
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> jacques.le.roux wrote:
>>>>
>>>> Hello Alfredo,
>>>>
>>>> Did you create a such Axis2 component ? If yes couls you think about
>>>> creating a Jira issue and submit a patch ?
>>>>
>>>> Thanks
>>>>
>>>> Jacques
>>>>
>>>> From: "Alfredo Rueda" <[hidden email]>
>>>>>
>>>>> Hello Dhruv!
>>>>>
>>>>> A collection of Ofbiz services have been exposed as Web Services using
>>>>> this
>>>>> solution:
>>>>>
>>>>> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP
>>>>>
>>>>> These Web Services have been deployed in a production environment and
>>>>> are
>>>>> working perfectly fine.
>>>>>
>>>>> I suggest you to follow the steps, and I will be glad to help you if
>>>>> you
>>>>> run
>>>>> into trouble at some point in the process.
>>>>>
>>>>> Once you finish you can create your own Axis2 Ofbiz Component to
>>>>> provide
>>>>> a
>>>>> cleaner solution. This Axis2 Ofbiz Component will serve as a Web
>>>>> Service
>>>>> Facade to comunicate Ofbiz with other systems.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Alfredo Rueda
>>>>>
>>>>>
>>>>> Dhruv Datta wrote:
>>>>>>
>>>>>> Hi Frns,
>>>>>>
>>>>>> I am using "wsimport" tool to read an existing WSDL file of OFBiz
>>>>>> framework and want to generate artifacts. I need these because I am
>>>>>> doing load testing on Web Service and retrieve data like the average
>>>>>> time requierd to obtain the reponse from a webservice.
>>>>>>
>>>>>> So I've following questions:
>>>>>>
>>>>>> 1) How to expose the existing WebServices of the OFBiz ?
>>>>>> 2) What meaningful data will these services provide?
>>>>>>
>>>>>> I am trying to expose a Web Service by using following syntax:
>>>>>>
>>>>>> E:\WSDL>wsimport -d .
>>>>>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL
>>>>>>
>>>>>> And I am getting following error :
>>>>>>
>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>>>>>> document-literal operation, message part must refer to a schema
>>>>>> element declaration
>>>>>>
>>>>>>
>>>>>> Any help would be greatly appreciated.
>>>>>>
>>>>>> Thanks in Advance.
>>>>>>
>>>>>> Dhruv.
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html
>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22160487.html
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22163567.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22164077.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

Vince Clark
Thank you Jacques. Your suggestion raises something that I was confused about. What is different about "events" and "services?" I wasn't sure if we could just define a service as you put it, a "cover" service. Why was the event not defined as a service in the first place?

I'll look thru the docs but any clarification you can provide would be appreciated.

----- Original Message -----
From: "Jacques Le Roux" <[hidden email]>
To: [hidden email]
Sent: Wednesday, February 25, 2009 12:59:29 PM (GMT-0600) America/Chicago
Subject: Re: How to expose Web Service of OFBiz ?

Why not create cover services around events if it's your problem ? (Not sure someone did not already suggest this to you, was half
somewhere else those last days...)

Jacques

From: "Vince M. Clark" <[hidden email]>

> This helps, thank you. Your example goes further than the one in the how to.
>
> Could you shed some light on this scenario? We want to use all the shopping cart functionality and are struggling with how to put
> all the pieces together.
> If I use OFBiz ecommerce as a guide and trace thru the code I see that from the ecommerce site if I click "add to cart" it calls a
> request map called "additem" in the controller.
> That request map calls the following event:
> <event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="addToCart"/>
> which is not defined as a service. So we are a bit confused as to how we can mimick the shopping cart functionality thru web
> services.
> Should we call ShoppingCartEvents.addToCart() directly from our java class in Axis, and then use other methods defined as
> services, such as ShoppingCartServices.getShoppingCartData() to return up the stack?
>
> ----- Original Message -----
> From: "Alfredo Rueda" <[hidden email]>
> To: [hidden email]
> Sent: Monday, February 23, 2009 8:50:22 AM (GMT-0700) America/Denver
> Subject: Re: How to expose Web Service of OFBiz ?
>
>
> OK, I will be glad to help you, but please could you suggest me which Ofbiz
> service you want to export?
> I'm working with OpenTaps, so I don't know If OpenTaps will also have your
> web service included in their distro (OpenTaps is built upon Ofbiz??)
>
> Some example:
>
> GenericDelegator delegator =
> GenericDelegator.getGenericDelegator("default");
> LocalDispatcher dispatcher =
> GenericDispatcher.getLocalDispatcher("default",delegator);
> GenericValue admin = null;
> try {
> admin = delegator.findByPrimaryKey("UserLogin",
> UtilMisc.toMap("userLoginId", "admin"));
> } catch (GenericEntityException e1) {
> e1.printStackTrace();
> }
>
> Map result = null;
>
> Object[] params = {
> "login.username", un_username,
> "login.password", un_password,
> "domini", un_domini,
> .... (more params)
>
> "estat", un_estat,
> "ip", una_ip,
> "userLogin", admin
> };
>
> try {
> result = dispatcher.runSync("put here the name of your ofbiz service",
> UtilMisc.toMap(params));
> } catch (GenericServiceException e) {
> e.printStackTrace();
> }
>
> // Now get the result using result variable
>
>
> Hope that helps!
>
>
>
> Vince Clark wrote:
>>
>> OK that makes sense. Yes I agree it would not make sense to publish custom
>> services you have written for a customer. But examples of OFBiz standard
>> services being exported would be very helpful, along with the directory
>> structure, supporting files, etc. for deploying as an OFBiz component. For
>> example, did you deploy the entire binary distribution, or just axis2.war?
>>
>> A jira issue that explains your solution along with a patch would be
>> fantastic! Before doing that, would you mind just replying to this thread
>> with a code sample showing the call to a standard OFBiz service and how
>> you are dealing with the results? It would be very timely as we are
>> struggling with this very thing right now.
>>
>> ----- Original Message -----
>> From: "Alfredo Rueda" <[hidden email]>
>> To: [hidden email]
>> Sent: Monday, February 23, 2009 8:23:39 AM (GMT-0700) America/Denver
>> Subject: Re: How to expose Web Service of OFBiz ?
>>
>>
>> Hello Vince,
>>
>> Yes, I have deployed Axis2 as its own OFBiz component.
>>
>> "The example code
>> will be a java file that exports two Ofbiz Services that come with Ofbiz
>> Distribution (now I'm exporting customer specific Ofbiz Services, that is
>> why it's nonsense to publish this java file.)"
>>
>> I meant that it's nonsense to publish an example in which I export
>> customer
>> specific ofbiz services, because I have to provide also a lot of code that
>> the customer specific ofbiz service relies on, for instance, ofbiz service
>> minilang implementation, lot of subservices, views entities, etc, etc,
>> etc.
>>
>> The purpose is just to show how to export ofbiz services that use complex
>> type parameters, so why not use as an example standard ofbiz services that
>> comes with Ofbiz Distribution? This was the only thing I tried to explain
>> before :-)
>>
>> Regards,
>>
>> Alfredo
>>
>>
>>
>>
>>
>> Vince Clark wrote:
>>>
>>> Alfredo
>>>
>>> So to be clear, you have deployed Axis2 as its own OFBiz component? Or
>>> are
>>> you still using the approach of deploying the war file under an existing
>>> webapp directory in another component?
>>>
>>> A patch would be very helpful. Not sure why you think it is "nonsense."
>>> Working examples are extremely helpful to the community. Especially in
>>> new
>>> areas like this.
>>>
>>> To submit a patch you must create an account on Jira, then create an
>>> issue
>>> and attach the patch file.
>>>
>>> Looking forward to seeing what you have done!
>>>
>>> ----- Original Message -----
>>> From: "Alfredo Rueda" <[hidden email]>
>>> To: [hidden email]
>>> Sent: Monday, February 23, 2009 5:17:53 AM (GMT-0700) America/Denver
>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>
>>>
>>> Hello Jacques!
>>>
>>> The Axis2 Ofbiz Component is simply an Ofbiz Component that has:
>>>
>>> 1. Axis2 1.4 Distribution stored in a subdirectory.
>>> 2. The Ofbiz build system is connected to Axis2 build system via an Ant
>>> build.xml file
>>> 3. A java file that is a Web Services Facade to Ofbiz Services that want
>>> to
>>> be exported.
>>>
>>> So, the only code that need to be published is:
>>> 1. The java file that is a Web Services Facade to Ofbiz Services that
>>> want
>>> to be exported.
>>> This file contains simply a Java Class that has 1 wrapper method for
>>> each Ofbiz Service that want to be exported. Axis2 does the job of
>>> exporting
>>> java methods as WebServices. It's amazing!
>>> 2. The build.xml of the component that builds the java file and puts the
>>> class file in an specific Axis2 directory
>>>
>>> The Ofbiz community may consider to include this ready to use Axis2 Ofbiz
>>> component that includes Axis2 Distribution and some Ofbiz Services
>>> exported
>>> via SOAP as an example of use.
>>>
>>> So, in this case the JIRA issue could be an idea more than code changes
>>> of
>>> existing Ofbiz code?
>>> How can I publish this idea as a JIRA issue?
>>> If the community thinks that is a good idea, then I will be glad to
>>> provide
>>> an example code (for instance 2 Ofbiz services that use complex types
>>> exported via SOAP), the build.xml and the documentation. The example code
>>> will be a java file that exports two Ofbiz Services that come with Ofbiz
>>> Distribution (now I'm exporting customer specific Ofbiz Services, that is
>>> why It's nonsense to publish this java file.)
>>>
>>> Regards,
>>>
>>> Alfredo
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> jacques.le.roux wrote:
>>>>
>>>> Hello Alfredo,
>>>>
>>>> Did you create a such Axis2 component ? If yes couls you think about
>>>> creating a Jira issue and submit a patch ?
>>>>
>>>> Thanks
>>>>
>>>> Jacques
>>>>
>>>> From: "Alfredo Rueda" <[hidden email]>
>>>>>
>>>>> Hello Dhruv!
>>>>>
>>>>> A collection of Ofbiz services have been exposed as Web Services using
>>>>> this
>>>>> solution:
>>>>>
>>>>> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP 
>>>>>
>>>>> These Web Services have been deployed in a production environment and
>>>>> are
>>>>> working perfectly fine.
>>>>>
>>>>> I suggest you to follow the steps, and I will be glad to help you if
>>>>> you
>>>>> run
>>>>> into trouble at some point in the process.
>>>>>
>>>>> Once you finish you can create your own Axis2 Ofbiz Component to
>>>>> provide
>>>>> a
>>>>> cleaner solution. This Axis2 Ofbiz Component will serve as a Web
>>>>> Service
>>>>> Facade to comunicate Ofbiz with other systems.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Alfredo Rueda
>>>>>
>>>>>
>>>>> Dhruv Datta wrote:
>>>>>>
>>>>>> Hi Frns,
>>>>>>
>>>>>> I am using "wsimport" tool to read an existing WSDL file of OFBiz
>>>>>> framework and want to generate artifacts. I need these because I am
>>>>>> doing load testing on Web Service and retrieve data like the average
>>>>>> time requierd to obtain the reponse from a webservice.
>>>>>>
>>>>>> So I've following questions:
>>>>>>
>>>>>> 1) How to expose the existing WebServices of the OFBiz ?
>>>>>> 2) What meaningful data will these services provide?
>>>>>>
>>>>>> I am trying to expose a Web Service by using following syntax:
>>>>>>
>>>>>> E:\WSDL>wsimport -d .
>>>>>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL 
>>>>>>
>>>>>> And I am getting following error :
>>>>>>
>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>>>>>> document-literal operation, message part must refer to a schema
>>>>>> element declaration
>>>>>>
>>>>>>
>>>>>> Any help would be greatly appreciated.
>>>>>>
>>>>>> Thanks in Advance.
>>>>>>
>>>>>> Dhruv.
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html 
>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22160487.html 
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22163567.html 
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22164077.html 
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

Jacques Le Roux
Administrator
As I see it, a (java or simple-method mostly) event is a simple response to a request which does not need further processing.
A service allows you to use Service Engine power : chain other services using SECA, etc.

Jacques

From: "Vince M. Clark" <[hidden email]>

> Thank you Jacques. Your suggestion raises something that I was confused about. What is different about "events" and "services?" I
> wasn't sure if we could just define a service as you put it, a "cover" service. Why was the event not defined as a service in the
> first place?
>
> I'll look thru the docs but any clarification you can provide would be appreciated.
>
> ----- Original Message -----
> From: "Jacques Le Roux" <[hidden email]>
> To: [hidden email]
> Sent: Wednesday, February 25, 2009 12:59:29 PM (GMT-0600) America/Chicago
> Subject: Re: How to expose Web Service of OFBiz ?
>
> Why not create cover services around events if it's your problem ? (Not sure someone did not already suggest this to you, was half
> somewhere else those last days...)
>
> Jacques
>
> From: "Vince M. Clark" <[hidden email]>
>> This helps, thank you. Your example goes further than the one in the how to.
>>
>> Could you shed some light on this scenario? We want to use all the shopping cart functionality and are struggling with how to put
>> all the pieces together.
>> If I use OFBiz ecommerce as a guide and trace thru the code I see that from the ecommerce site if I click "add to cart" it calls
>> a
>> request map called "additem" in the controller.
>> That request map calls the following event:
>> <event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="addToCart"/>
>> which is not defined as a service. So we are a bit confused as to how we can mimick the shopping cart functionality thru web
>> services.
>> Should we call ShoppingCartEvents.addToCart() directly from our java class in Axis, and then use other methods defined as
>> services, such as ShoppingCartServices.getShoppingCartData() to return up the stack?
>>
>> ----- Original Message -----
>> From: "Alfredo Rueda" <[hidden email]>
>> To: [hidden email]
>> Sent: Monday, February 23, 2009 8:50:22 AM (GMT-0700) America/Denver
>> Subject: Re: How to expose Web Service of OFBiz ?
>>
>>
>> OK, I will be glad to help you, but please could you suggest me which Ofbiz
>> service you want to export?
>> I'm working with OpenTaps, so I don't know If OpenTaps will also have your
>> web service included in their distro (OpenTaps is built upon Ofbiz??)
>>
>> Some example:
>>
>> GenericDelegator delegator =
>> GenericDelegator.getGenericDelegator("default");
>> LocalDispatcher dispatcher =
>> GenericDispatcher.getLocalDispatcher("default",delegator);
>> GenericValue admin = null;
>> try {
>> admin = delegator.findByPrimaryKey("UserLogin",
>> UtilMisc.toMap("userLoginId", "admin"));
>> } catch (GenericEntityException e1) {
>> e1.printStackTrace();
>> }
>>
>> Map result = null;
>>
>> Object[] params = {
>> "login.username", un_username,
>> "login.password", un_password,
>> "domini", un_domini,
>> .... (more params)
>>
>> "estat", un_estat,
>> "ip", una_ip,
>> "userLogin", admin
>> };
>>
>> try {
>> result = dispatcher.runSync("put here the name of your ofbiz service",
>> UtilMisc.toMap(params));
>> } catch (GenericServiceException e) {
>> e.printStackTrace();
>> }
>>
>> // Now get the result using result variable
>>
>>
>> Hope that helps!
>>
>>
>>
>> Vince Clark wrote:
>>>
>>> OK that makes sense. Yes I agree it would not make sense to publish custom
>>> services you have written for a customer. But examples of OFBiz standard
>>> services being exported would be very helpful, along with the directory
>>> structure, supporting files, etc. for deploying as an OFBiz component. For
>>> example, did you deploy the entire binary distribution, or just axis2.war?
>>>
>>> A jira issue that explains your solution along with a patch would be
>>> fantastic! Before doing that, would you mind just replying to this thread
>>> with a code sample showing the call to a standard OFBiz service and how
>>> you are dealing with the results? It would be very timely as we are
>>> struggling with this very thing right now.
>>>
>>> ----- Original Message -----
>>> From: "Alfredo Rueda" <[hidden email]>
>>> To: [hidden email]
>>> Sent: Monday, February 23, 2009 8:23:39 AM (GMT-0700) America/Denver
>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>
>>>
>>> Hello Vince,
>>>
>>> Yes, I have deployed Axis2 as its own OFBiz component.
>>>
>>> "The example code
>>> will be a java file that exports two Ofbiz Services that come with Ofbiz
>>> Distribution (now I'm exporting customer specific Ofbiz Services, that is
>>> why it's nonsense to publish this java file.)"
>>>
>>> I meant that it's nonsense to publish an example in which I export
>>> customer
>>> specific ofbiz services, because I have to provide also a lot of code that
>>> the customer specific ofbiz service relies on, for instance, ofbiz service
>>> minilang implementation, lot of subservices, views entities, etc, etc,
>>> etc.
>>>
>>> The purpose is just to show how to export ofbiz services that use complex
>>> type parameters, so why not use as an example standard ofbiz services that
>>> comes with Ofbiz Distribution? This was the only thing I tried to explain
>>> before :-)
>>>
>>> Regards,
>>>
>>> Alfredo
>>>
>>>
>>>
>>>
>>>
>>> Vince Clark wrote:
>>>>
>>>> Alfredo
>>>>
>>>> So to be clear, you have deployed Axis2 as its own OFBiz component? Or
>>>> are
>>>> you still using the approach of deploying the war file under an existing
>>>> webapp directory in another component?
>>>>
>>>> A patch would be very helpful. Not sure why you think it is "nonsense."
>>>> Working examples are extremely helpful to the community. Especially in
>>>> new
>>>> areas like this.
>>>>
>>>> To submit a patch you must create an account on Jira, then create an
>>>> issue
>>>> and attach the patch file.
>>>>
>>>> Looking forward to seeing what you have done!
>>>>
>>>> ----- Original Message -----
>>>> From: "Alfredo Rueda" <[hidden email]>
>>>> To: [hidden email]
>>>> Sent: Monday, February 23, 2009 5:17:53 AM (GMT-0700) America/Denver
>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>
>>>>
>>>> Hello Jacques!
>>>>
>>>> The Axis2 Ofbiz Component is simply an Ofbiz Component that has:
>>>>
>>>> 1. Axis2 1.4 Distribution stored in a subdirectory.
>>>> 2. The Ofbiz build system is connected to Axis2 build system via an Ant
>>>> build.xml file
>>>> 3. A java file that is a Web Services Facade to Ofbiz Services that want
>>>> to
>>>> be exported.
>>>>
>>>> So, the only code that need to be published is:
>>>> 1. The java file that is a Web Services Facade to Ofbiz Services that
>>>> want
>>>> to be exported.
>>>> This file contains simply a Java Class that has 1 wrapper method for
>>>> each Ofbiz Service that want to be exported. Axis2 does the job of
>>>> exporting
>>>> java methods as WebServices. It's amazing!
>>>> 2. The build.xml of the component that builds the java file and puts the
>>>> class file in an specific Axis2 directory
>>>>
>>>> The Ofbiz community may consider to include this ready to use Axis2 Ofbiz
>>>> component that includes Axis2 Distribution and some Ofbiz Services
>>>> exported
>>>> via SOAP as an example of use.
>>>>
>>>> So, in this case the JIRA issue could be an idea more than code changes
>>>> of
>>>> existing Ofbiz code?
>>>> How can I publish this idea as a JIRA issue?
>>>> If the community thinks that is a good idea, then I will be glad to
>>>> provide
>>>> an example code (for instance 2 Ofbiz services that use complex types
>>>> exported via SOAP), the build.xml and the documentation. The example code
>>>> will be a java file that exports two Ofbiz Services that come with Ofbiz
>>>> Distribution (now I'm exporting customer specific Ofbiz Services, that is
>>>> why It's nonsense to publish this java file.)
>>>>
>>>> Regards,
>>>>
>>>> Alfredo
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> jacques.le.roux wrote:
>>>>>
>>>>> Hello Alfredo,
>>>>>
>>>>> Did you create a such Axis2 component ? If yes couls you think about
>>>>> creating a Jira issue and submit a patch ?
>>>>>
>>>>> Thanks
>>>>>
>>>>> Jacques
>>>>>
>>>>> From: "Alfredo Rueda" <[hidden email]>
>>>>>>
>>>>>> Hello Dhruv!
>>>>>>
>>>>>> A collection of Ofbiz services have been exposed as Web Services using
>>>>>> this
>>>>>> solution:
>>>>>>
>>>>>> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP
>>>>>>
>>>>>> These Web Services have been deployed in a production environment and
>>>>>> are
>>>>>> working perfectly fine.
>>>>>>
>>>>>> I suggest you to follow the steps, and I will be glad to help you if
>>>>>> you
>>>>>> run
>>>>>> into trouble at some point in the process.
>>>>>>
>>>>>> Once you finish you can create your own Axis2 Ofbiz Component to
>>>>>> provide
>>>>>> a
>>>>>> cleaner solution. This Axis2 Ofbiz Component will serve as a Web
>>>>>> Service
>>>>>> Facade to comunicate Ofbiz with other systems.
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Alfredo Rueda
>>>>>>
>>>>>>
>>>>>> Dhruv Datta wrote:
>>>>>>>
>>>>>>> Hi Frns,
>>>>>>>
>>>>>>> I am using "wsimport" tool to read an existing WSDL file of OFBiz
>>>>>>> framework and want to generate artifacts. I need these because I am
>>>>>>> doing load testing on Web Service and retrieve data like the average
>>>>>>> time requierd to obtain the reponse from a webservice.
>>>>>>>
>>>>>>> So I've following questions:
>>>>>>>
>>>>>>> 1) How to expose the existing WebServices of the OFBiz ?
>>>>>>> 2) What meaningful data will these services provide?
>>>>>>>
>>>>>>> I am trying to expose a Web Service by using following syntax:
>>>>>>>
>>>>>>> E:\WSDL>wsimport -d .
>>>>>>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL
>>>>>>>
>>>>>>> And I am getting following error :
>>>>>>>
>>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>>>>>>> document-literal operation, message part must refer to a schema
>>>>>>> element declaration
>>>>>>>
>>>>>>>
>>>>>>> Any help would be greatly appreciated.
>>>>>>>
>>>>>>> Thanks in Advance.
>>>>>>>
>>>>>>> Dhruv.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html
>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22160487.html
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22163567.html
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22164077.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

BJ Freeman
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

to add to this
and event has unstructured data, where you can seed data not in the
entities to be processed.
where a service has structured input and output with input validation.

Jacques Le Roux sent the following on 2/28/2009 9:27 AM:

> As I see it, a (java or simple-method mostly) event is a simple response
> to a request which does not need further processing.
> A service allows you to use Service Engine power : chain other services
> using SECA, etc.
>
> Jacques
>
> From: "Vince M. Clark" <[hidden email]>
>> Thank you Jacques. Your suggestion raises something that I was
>> confused about. What is different about "events" and "services?" I
>> wasn't sure if we could just define a service as you put it, a "cover"
>> service. Why was the event not defined as a service in the
>> first place?
>>
>> I'll look thru the docs but any clarification you can provide would be
>> appreciated.
>>
>> ----- Original Message ----- From: "Jacques Le Roux"
>> <[hidden email]>
>> To: [hidden email]
>> Sent: Wednesday, February 25, 2009 12:59:29 PM (GMT-0600) America/Chicago
>> Subject: Re: How to expose Web Service of OFBiz ?
>>
>> Why not create cover services around events if it's your problem ?
>> (Not sure someone did not already suggest this to you, was half
>> somewhere else those last days...)
>>
>> Jacques
>>
>> From: "Vince M. Clark" <[hidden email]>
>>> This helps, thank you. Your example goes further than the one in the
>>> how to.
>>>
>>> Could you shed some light on this scenario? We want to use all the
>>> shopping cart functionality and are struggling with how to put
>>> all the pieces together.
>>> If I use OFBiz ecommerce as a guide and trace thru the code I see
>>> that from the ecommerce site if I click "add to cart" it calls
>>> a
>>> request map called "additem" in the controller.
>>> That request map calls the following event:
>>> <event type="java"
>>> path="org.ofbiz.order.shoppingcart.ShoppingCartEvents"
>>> invoke="addToCart"/>
>>> which is not defined as a service. So we are a bit confused as to how
>>> we can mimick the shopping cart functionality thru web
>>> services.
>>> Should we call ShoppingCartEvents.addToCart() directly from our java
>>> class in Axis, and then use other methods defined as
>>> services, such as ShoppingCartServices.getShoppingCartData() to
>>> return up the stack?
>>>
>>> ----- Original Message ----- From: "Alfredo Rueda"
>>> <[hidden email]>
>>> To: [hidden email]
>>> Sent: Monday, February 23, 2009 8:50:22 AM (GMT-0700) America/Denver
>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>
>>>
>>> OK, I will be glad to help you, but please could you suggest me which
>>> Ofbiz
>>> service you want to export?
>>> I'm working with OpenTaps, so I don't know If OpenTaps will also have
>>> your
>>> web service included in their distro (OpenTaps is built upon Ofbiz??)
>>>
>>> Some example:
>>>
>>> GenericDelegator delegator =
>>> GenericDelegator.getGenericDelegator("default");
>>> LocalDispatcher dispatcher =
>>> GenericDispatcher.getLocalDispatcher("default",delegator);
>>> GenericValue admin = null;
>>> try {
>>> admin = delegator.findByPrimaryKey("UserLogin",
>>> UtilMisc.toMap("userLoginId", "admin"));
>>> } catch (GenericEntityException e1) {
>>> e1.printStackTrace();
>>> }
>>>
>>> Map result = null;
>>>
>>> Object[] params = {
>>> "login.username", un_username,
>>> "login.password", un_password,
>>> "domini", un_domini,
>>> .... (more params)
>>>
>>> "estat", un_estat,
>>> "ip", una_ip,
>>> "userLogin", admin
>>> };
>>>
>>> try {
>>> result = dispatcher.runSync("put here the name of your ofbiz service",
>>> UtilMisc.toMap(params));
>>> } catch (GenericServiceException e) {
>>> e.printStackTrace();
>>> }
>>>
>>> // Now get the result using result variable
>>>
>>>
>>> Hope that helps!
>>>
>>>
>>>
>>> Vince Clark wrote:
>>>>
>>>> OK that makes sense. Yes I agree it would not make sense to publish
>>>> custom
>>>> services you have written for a customer. But examples of OFBiz
>>>> standard
>>>> services being exported would be very helpful, along with the directory
>>>> structure, supporting files, etc. for deploying as an OFBiz
>>>> component. For
>>>> example, did you deploy the entire binary distribution, or just
>>>> axis2.war?
>>>>
>>>> A jira issue that explains your solution along with a patch would be
>>>> fantastic! Before doing that, would you mind just replying to this
>>>> thread
>>>> with a code sample showing the call to a standard OFBiz service and how
>>>> you are dealing with the results? It would be very timely as we are
>>>> struggling with this very thing right now.
>>>>
>>>> ----- Original Message ----- From: "Alfredo Rueda"
>>>> <[hidden email]>
>>>> To: [hidden email]
>>>> Sent: Monday, February 23, 2009 8:23:39 AM (GMT-0700) America/Denver
>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>
>>>>
>>>> Hello Vince,
>>>>
>>>> Yes, I have deployed Axis2 as its own OFBiz component.
>>>>
>>>> "The example code
>>>> will be a java file that exports two Ofbiz Services that come with
>>>> Ofbiz
>>>> Distribution (now I'm exporting customer specific Ofbiz Services,
>>>> that is
>>>> why it's nonsense to publish this java file.)"
>>>>
>>>> I meant that it's nonsense to publish an example in which I export
>>>> customer
>>>> specific ofbiz services, because I have to provide also a lot of
>>>> code that
>>>> the customer specific ofbiz service relies on, for instance, ofbiz
>>>> service
>>>> minilang implementation, lot of subservices, views entities, etc, etc,
>>>> etc.
>>>>
>>>> The purpose is just to show how to export ofbiz services that use
>>>> complex
>>>> type parameters, so why not use as an example standard ofbiz
>>>> services that
>>>> comes with Ofbiz Distribution? This was the only thing I tried to
>>>> explain
>>>> before :-)
>>>>
>>>> Regards,
>>>>
>>>> Alfredo
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Vince Clark wrote:
>>>>>
>>>>> Alfredo
>>>>>
>>>>> So to be clear, you have deployed Axis2 as its own OFBiz component? Or
>>>>> are
>>>>> you still using the approach of deploying the war file under an
>>>>> existing
>>>>> webapp directory in another component?
>>>>>
>>>>> A patch would be very helpful. Not sure why you think it is
>>>>> "nonsense."
>>>>> Working examples are extremely helpful to the community. Especially in
>>>>> new
>>>>> areas like this.
>>>>>
>>>>> To submit a patch you must create an account on Jira, then create an
>>>>> issue
>>>>> and attach the patch file.
>>>>>
>>>>> Looking forward to seeing what you have done!
>>>>>
>>>>> ----- Original Message ----- From: "Alfredo Rueda"
>>>>> <[hidden email]>
>>>>> To: [hidden email]
>>>>> Sent: Monday, February 23, 2009 5:17:53 AM (GMT-0700) America/Denver
>>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>>
>>>>>
>>>>> Hello Jacques!
>>>>>
>>>>> The Axis2 Ofbiz Component is simply an Ofbiz Component that has:
>>>>>
>>>>> 1. Axis2 1.4 Distribution stored in a subdirectory.
>>>>> 2. The Ofbiz build system is connected to Axis2 build system via an
>>>>> Ant
>>>>> build.xml file
>>>>> 3. A java file that is a Web Services Facade to Ofbiz Services that
>>>>> want
>>>>> to
>>>>> be exported.
>>>>>
>>>>> So, the only code that need to be published is:
>>>>> 1. The java file that is a Web Services Facade to Ofbiz Services that
>>>>> want
>>>>> to be exported.
>>>>> This file contains simply a Java Class that has 1 wrapper method for
>>>>> each Ofbiz Service that want to be exported. Axis2 does the job of
>>>>> exporting
>>>>> java methods as WebServices. It's amazing!
>>>>> 2. The build.xml of the component that builds the java file and
>>>>> puts the
>>>>> class file in an specific Axis2 directory
>>>>>
>>>>> The Ofbiz community may consider to include this ready to use Axis2
>>>>> Ofbiz
>>>>> component that includes Axis2 Distribution and some Ofbiz Services
>>>>> exported
>>>>> via SOAP as an example of use.
>>>>>
>>>>> So, in this case the JIRA issue could be an idea more than code
>>>>> changes
>>>>> of
>>>>> existing Ofbiz code?
>>>>> How can I publish this idea as a JIRA issue?
>>>>> If the community thinks that is a good idea, then I will be glad to
>>>>> provide
>>>>> an example code (for instance 2 Ofbiz services that use complex types
>>>>> exported via SOAP), the build.xml and the documentation. The
>>>>> example code
>>>>> will be a java file that exports two Ofbiz Services that come with
>>>>> Ofbiz
>>>>> Distribution (now I'm exporting customer specific Ofbiz Services,
>>>>> that is
>>>>> why It's nonsense to publish this java file.)
>>>>>
>>>>> Regards,
>>>>>
>>>>> Alfredo
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> jacques.le.roux wrote:
>>>>>>
>>>>>> Hello Alfredo,
>>>>>>
>>>>>> Did you create a such Axis2 component ? If yes couls you think about
>>>>>> creating a Jira issue and submit a patch ?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Jacques
>>>>>>
>>>>>> From: "Alfredo Rueda" <[hidden email]>
>>>>>>>
>>>>>>> Hello Dhruv!
>>>>>>>
>>>>>>> A collection of Ofbiz services have been exposed as Web Services
>>>>>>> using
>>>>>>> this
>>>>>>> solution:
>>>>>>>
>>>>>>> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP
>>>>>>>
>>>>>>>
>>>>>>> These Web Services have been deployed in a production environment
>>>>>>> and
>>>>>>> are
>>>>>>> working perfectly fine.
>>>>>>>
>>>>>>> I suggest you to follow the steps, and I will be glad to help you if
>>>>>>> you
>>>>>>> run
>>>>>>> into trouble at some point in the process.
>>>>>>>
>>>>>>> Once you finish you can create your own Axis2 Ofbiz Component to
>>>>>>> provide
>>>>>>> a
>>>>>>> cleaner solution. This Axis2 Ofbiz Component will serve as a Web
>>>>>>> Service
>>>>>>> Facade to comunicate Ofbiz with other systems.
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Alfredo Rueda
>>>>>>>
>>>>>>>
>>>>>>> Dhruv Datta wrote:
>>>>>>>>
>>>>>>>> Hi Frns,
>>>>>>>>
>>>>>>>> I am using "wsimport" tool to read an existing WSDL file of OFBiz
>>>>>>>> framework and want to generate artifacts. I need these because I am
>>>>>>>> doing load testing on Web Service and retrieve data like the
>>>>>>>> average
>>>>>>>> time requierd to obtain the reponse from a webservice.
>>>>>>>>
>>>>>>>> So I've following questions:
>>>>>>>>
>>>>>>>> 1) How to expose the existing WebServices of the OFBiz ?
>>>>>>>> 2) What meaningful data will these services provide?
>>>>>>>>
>>>>>>>> I am trying to expose a Web Service by using following syntax:
>>>>>>>>
>>>>>>>> E:\WSDL>wsimport -d .
>>>>>>>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL
>>>>>>>>
>>>>>>>>
>>>>>>>> And I am getting following error :
>>>>>>>>
>>>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>>>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>>>>>>>> document-literal operation, message part must refer to a schema
>>>>>>>> element declaration
>>>>>>>>
>>>>>>>>
>>>>>>>> Any help would be greatly appreciated.
>>>>>>>>
>>>>>>>> Thanks in Advance.
>>>>>>>>
>>>>>>>> Dhruv.
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html
>>>>>>>
>>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22160487.html
>>>>>
>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22163567.html
>>>>
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22164077.html
>>>
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>
>
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJqXfarP3NbaWWqE4RApKpAJ9Ufhaonj5xjEQ8qS6oNikNmusmEQCgtmVa
EXXGCd+cwfy7VGJPeKHDRO8=
=Y7BS
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

Vince Clark
Thanks for all the feedback on this. The ShoppingCart object is what we have been working with that originally raised the question. As we have progressed thru our learning curve of creating web services using Axis, Anthony (my coworker) figured out how to use the ShoppingCart without it being defined as a service in OFBiz. So our web service just creates a ShoppingCart object and if we need to persist it then we use ShoppingList services.

----- Original Message -----
From: "BJ Freeman" <[hidden email]>
To: [hidden email]
Sent: Saturday, February 28, 2009 10:43:55 AM (GMT-0700) America/Denver
Subject: Re: How to expose Web Service of OFBiz ?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

to add to this
and event has unstructured data, where you can seed data not in the
entities to be processed.
where a service has structured input and output with input validation.

Jacques Le Roux sent the following on 2/28/2009 9:27 AM:

> As I see it, a (java or simple-method mostly) event is a simple response
> to a request which does not need further processing.
> A service allows you to use Service Engine power : chain other services
> using SECA, etc.
>
> Jacques
>
> From: "Vince M. Clark" <[hidden email]>
>> Thank you Jacques. Your suggestion raises something that I was
>> confused about. What is different about "events" and "services?" I
>> wasn't sure if we could just define a service as you put it, a "cover"
>> service. Why was the event not defined as a service in the
>> first place?
>>
>> I'll look thru the docs but any clarification you can provide would be
>> appreciated.
>>
>> ----- Original Message ----- From: "Jacques Le Roux"
>> <[hidden email]>
>> To: [hidden email]
>> Sent: Wednesday, February 25, 2009 12:59:29 PM (GMT-0600) America/Chicago
>> Subject: Re: How to expose Web Service of OFBiz ?
>>
>> Why not create cover services around events if it's your problem ?
>> (Not sure someone did not already suggest this to you, was half
>> somewhere else those last days...)
>>
>> Jacques
>>
>> From: "Vince M. Clark" <[hidden email]>
>>> This helps, thank you. Your example goes further than the one in the
>>> how to.
>>>
>>> Could you shed some light on this scenario? We want to use all the
>>> shopping cart functionality and are struggling with how to put
>>> all the pieces together.
>>> If I use OFBiz ecommerce as a guide and trace thru the code I see
>>> that from the ecommerce site if I click "add to cart" it calls
>>> a
>>> request map called "additem" in the controller.
>>> That request map calls the following event:
>>> <event type="java"
>>> path="org.ofbiz.order.shoppingcart.ShoppingCartEvents"
>>> invoke="addToCart"/>
>>> which is not defined as a service. So we are a bit confused as to how
>>> we can mimick the shopping cart functionality thru web
>>> services.
>>> Should we call ShoppingCartEvents.addToCart() directly from our java
>>> class in Axis, and then use other methods defined as
>>> services, such as ShoppingCartServices.getShoppingCartData() to
>>> return up the stack?
>>>
>>> ----- Original Message ----- From: "Alfredo Rueda"
>>> <[hidden email]>
>>> To: [hidden email]
>>> Sent: Monday, February 23, 2009 8:50:22 AM (GMT-0700) America/Denver
>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>
>>>
>>> OK, I will be glad to help you, but please could you suggest me which
>>> Ofbiz
>>> service you want to export?
>>> I'm working with OpenTaps, so I don't know If OpenTaps will also have
>>> your
>>> web service included in their distro (OpenTaps is built upon Ofbiz??)
>>>
>>> Some example:
>>>
>>> GenericDelegator delegator =
>>> GenericDelegator.getGenericDelegator("default");
>>> LocalDispatcher dispatcher =
>>> GenericDispatcher.getLocalDispatcher("default",delegator);
>>> GenericValue admin = null;
>>> try {
>>> admin = delegator.findByPrimaryKey("UserLogin",
>>> UtilMisc.toMap("userLoginId", "admin"));
>>> } catch (GenericEntityException e1) {
>>> e1.printStackTrace();
>>> }
>>>
>>> Map result = null;
>>>
>>> Object[] params = {
>>> "login.username", un_username,
>>> "login.password", un_password,
>>> "domini", un_domini,
>>> .... (more params)
>>>
>>> "estat", un_estat,
>>> "ip", una_ip,
>>> "userLogin", admin
>>> };
>>>
>>> try {
>>> result = dispatcher.runSync("put here the name of your ofbiz service",
>>> UtilMisc.toMap(params));
>>> } catch (GenericServiceException e) {
>>> e.printStackTrace();
>>> }
>>>
>>> // Now get the result using result variable
>>>
>>>
>>> Hope that helps!
>>>
>>>
>>>
>>> Vince Clark wrote:
>>>>
>>>> OK that makes sense. Yes I agree it would not make sense to publish
>>>> custom
>>>> services you have written for a customer. But examples of OFBiz
>>>> standard
>>>> services being exported would be very helpful, along with the directory
>>>> structure, supporting files, etc. for deploying as an OFBiz
>>>> component. For
>>>> example, did you deploy the entire binary distribution, or just
>>>> axis2.war?
>>>>
>>>> A jira issue that explains your solution along with a patch would be
>>>> fantastic! Before doing that, would you mind just replying to this
>>>> thread
>>>> with a code sample showing the call to a standard OFBiz service and how
>>>> you are dealing with the results? It would be very timely as we are
>>>> struggling with this very thing right now.
>>>>
>>>> ----- Original Message ----- From: "Alfredo Rueda"
>>>> <[hidden email]>
>>>> To: [hidden email]
>>>> Sent: Monday, February 23, 2009 8:23:39 AM (GMT-0700) America/Denver
>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>
>>>>
>>>> Hello Vince,
>>>>
>>>> Yes, I have deployed Axis2 as its own OFBiz component.
>>>>
>>>> "The example code
>>>> will be a java file that exports two Ofbiz Services that come with
>>>> Ofbiz
>>>> Distribution (now I'm exporting customer specific Ofbiz Services,
>>>> that is
>>>> why it's nonsense to publish this java file.)"
>>>>
>>>> I meant that it's nonsense to publish an example in which I export
>>>> customer
>>>> specific ofbiz services, because I have to provide also a lot of
>>>> code that
>>>> the customer specific ofbiz service relies on, for instance, ofbiz
>>>> service
>>>> minilang implementation, lot of subservices, views entities, etc, etc,
>>>> etc.
>>>>
>>>> The purpose is just to show how to export ofbiz services that use
>>>> complex
>>>> type parameters, so why not use as an example standard ofbiz
>>>> services that
>>>> comes with Ofbiz Distribution? This was the only thing I tried to
>>>> explain
>>>> before :-)
>>>>
>>>> Regards,
>>>>
>>>> Alfredo
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Vince Clark wrote:
>>>>>
>>>>> Alfredo
>>>>>
>>>>> So to be clear, you have deployed Axis2 as its own OFBiz component? Or
>>>>> are
>>>>> you still using the approach of deploying the war file under an
>>>>> existing
>>>>> webapp directory in another component?
>>>>>
>>>>> A patch would be very helpful. Not sure why you think it is
>>>>> "nonsense."
>>>>> Working examples are extremely helpful to the community. Especially in
>>>>> new
>>>>> areas like this.
>>>>>
>>>>> To submit a patch you must create an account on Jira, then create an
>>>>> issue
>>>>> and attach the patch file.
>>>>>
>>>>> Looking forward to seeing what you have done!
>>>>>
>>>>> ----- Original Message ----- From: "Alfredo Rueda"
>>>>> <[hidden email]>
>>>>> To: [hidden email]
>>>>> Sent: Monday, February 23, 2009 5:17:53 AM (GMT-0700) America/Denver
>>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>>
>>>>>
>>>>> Hello Jacques!
>>>>>
>>>>> The Axis2 Ofbiz Component is simply an Ofbiz Component that has:
>>>>>
>>>>> 1. Axis2 1.4 Distribution stored in a subdirectory.
>>>>> 2. The Ofbiz build system is connected to Axis2 build system via an
>>>>> Ant
>>>>> build.xml file
>>>>> 3. A java file that is a Web Services Facade to Ofbiz Services that
>>>>> want
>>>>> to
>>>>> be exported.
>>>>>
>>>>> So, the only code that need to be published is:
>>>>> 1. The java file that is a Web Services Facade to Ofbiz Services that
>>>>> want
>>>>> to be exported.
>>>>> This file contains simply a Java Class that has 1 wrapper method for
>>>>> each Ofbiz Service that want to be exported. Axis2 does the job of
>>>>> exporting
>>>>> java methods as WebServices. It's amazing!
>>>>> 2. The build.xml of the component that builds the java file and
>>>>> puts the
>>>>> class file in an specific Axis2 directory
>>>>>
>>>>> The Ofbiz community may consider to include this ready to use Axis2
>>>>> Ofbiz
>>>>> component that includes Axis2 Distribution and some Ofbiz Services
>>>>> exported
>>>>> via SOAP as an example of use.
>>>>>
>>>>> So, in this case the JIRA issue could be an idea more than code
>>>>> changes
>>>>> of
>>>>> existing Ofbiz code?
>>>>> How can I publish this idea as a JIRA issue?
>>>>> If the community thinks that is a good idea, then I will be glad to
>>>>> provide
>>>>> an example code (for instance 2 Ofbiz services that use complex types
>>>>> exported via SOAP), the build.xml and the documentation. The
>>>>> example code
>>>>> will be a java file that exports two Ofbiz Services that come with
>>>>> Ofbiz
>>>>> Distribution (now I'm exporting customer specific Ofbiz Services,
>>>>> that is
>>>>> why It's nonsense to publish this java file.)
>>>>>
>>>>> Regards,
>>>>>
>>>>> Alfredo
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> jacques.le.roux wrote:
>>>>>>
>>>>>> Hello Alfredo,
>>>>>>
>>>>>> Did you create a such Axis2 component ? If yes couls you think about
>>>>>> creating a Jira issue and submit a patch ?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Jacques
>>>>>>
>>>>>> From: "Alfredo Rueda" <[hidden email]>
>>>>>>>
>>>>>>> Hello Dhruv!
>>>>>>>
>>>>>>> A collection of Ofbiz services have been exposed as Web Services
>>>>>>> using
>>>>>>> this
>>>>>>> solution:
>>>>>>>
>>>>>>> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP 
>>>>>>>
>>>>>>>
>>>>>>> These Web Services have been deployed in a production environment
>>>>>>> and
>>>>>>> are
>>>>>>> working perfectly fine.
>>>>>>>
>>>>>>> I suggest you to follow the steps, and I will be glad to help you if
>>>>>>> you
>>>>>>> run
>>>>>>> into trouble at some point in the process.
>>>>>>>
>>>>>>> Once you finish you can create your own Axis2 Ofbiz Component to
>>>>>>> provide
>>>>>>> a
>>>>>>> cleaner solution. This Axis2 Ofbiz Component will serve as a Web
>>>>>>> Service
>>>>>>> Facade to comunicate Ofbiz with other systems.
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Alfredo Rueda
>>>>>>>
>>>>>>>
>>>>>>> Dhruv Datta wrote:
>>>>>>>>
>>>>>>>> Hi Frns,
>>>>>>>>
>>>>>>>> I am using "wsimport" tool to read an existing WSDL file of OFBiz
>>>>>>>> framework and want to generate artifacts. I need these because I am
>>>>>>>> doing load testing on Web Service and retrieve data like the
>>>>>>>> average
>>>>>>>> time requierd to obtain the reponse from a webservice.
>>>>>>>>
>>>>>>>> So I've following questions:
>>>>>>>>
>>>>>>>> 1) How to expose the existing WebServices of the OFBiz ?
>>>>>>>> 2) What meaningful data will these services provide?
>>>>>>>>
>>>>>>>> I am trying to expose a Web Service by using following syntax:
>>>>>>>>
>>>>>>>> E:\WSDL>wsimport -d .
>>>>>>>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL 
>>>>>>>>
>>>>>>>>
>>>>>>>> And I am getting following error :
>>>>>>>>
>>>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>>>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>>>>>>>> document-literal operation, message part must refer to a schema
>>>>>>>> element declaration
>>>>>>>>
>>>>>>>>
>>>>>>>> Any help would be greatly appreciated.
>>>>>>>>
>>>>>>>> Thanks in Advance.
>>>>>>>>
>>>>>>>> Dhruv.
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html 
>>>>>>>
>>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22160487.html 
>>>>>
>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22163567.html 
>>>>
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22164077.html 
>>>
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>
>
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org 

iD8DBQFJqXfarP3NbaWWqE4RApKpAJ9Ufhaonj5xjEQ8qS6oNikNmusmEQCgtmVa
EXXGCd+cwfy7VGJPeKHDRO8=
=Y7BS
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

BJ Freeman
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I am curious since you are not calling the service how all the SCAS and
ECAS are being compensated for.

Vince M. Clark sent the following on 2/28/2009 9:42 AM:

> Thanks for all the feedback on this. The ShoppingCart object is what we have been working with that originally raised the question. As we have progressed thru our learning curve of creating web services using Axis, Anthony (my coworker) figured out how to use the ShoppingCart without it being defined as a service in OFBiz. So our web service just creates a ShoppingCart object and if we need to persist it then we use ShoppingList services.
>
> ----- Original Message -----
> From: "BJ Freeman" <[hidden email]>
> To: [hidden email]
> Sent: Saturday, February 28, 2009 10:43:55 AM (GMT-0700) America/Denver
> Subject: Re: How to expose Web Service of OFBiz ?
>
> to add to this
> and event has unstructured data, where you can seed data not in the
> entities to be processed.
> where a service has structured input and output with input validation.
>
> Jacques Le Roux sent the following on 2/28/2009 9:27 AM:
>> As I see it, a (java or simple-method mostly) event is a simple response
>> to a request which does not need further processing.
>> A service allows you to use Service Engine power : chain other services
>> using SECA, etc.
>
>> Jacques
>
>> From: "Vince M. Clark" <[hidden email]>
>>> Thank you Jacques. Your suggestion raises something that I was
>>> confused about. What is different about "events" and "services?" I
>>> wasn't sure if we could just define a service as you put it, a "cover"
>>> service. Why was the event not defined as a service in the
>>> first place?
>>>
>>> I'll look thru the docs but any clarification you can provide would be
>>> appreciated.
>>>
>>> ----- Original Message ----- From: "Jacques Le Roux"
>>> <[hidden email]>
>>> To: [hidden email]
>>> Sent: Wednesday, February 25, 2009 12:59:29 PM (GMT-0600) America/Chicago
>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>
>>> Why not create cover services around events if it's your problem ?
>>> (Not sure someone did not already suggest this to you, was half
>>> somewhere else those last days...)
>>>
>>> Jacques
>>>
>>> From: "Vince M. Clark" <[hidden email]>
>>>> This helps, thank you. Your example goes further than the one in the
>>>> how to.
>>>>
>>>> Could you shed some light on this scenario? We want to use all the
>>>> shopping cart functionality and are struggling with how to put
>>>> all the pieces together.
>>>> If I use OFBiz ecommerce as a guide and trace thru the code I see
>>>> that from the ecommerce site if I click "add to cart" it calls
>>>> a
>>>> request map called "additem" in the controller.
>>>> That request map calls the following event:
>>>> <event type="java"
>>>> path="org.ofbiz.order.shoppingcart.ShoppingCartEvents"
>>>> invoke="addToCart"/>
>>>> which is not defined as a service. So we are a bit confused as to how
>>>> we can mimick the shopping cart functionality thru web
>>>> services.
>>>> Should we call ShoppingCartEvents.addToCart() directly from our java
>>>> class in Axis, and then use other methods defined as
>>>> services, such as ShoppingCartServices.getShoppingCartData() to
>>>> return up the stack?
>>>>
>>>> ----- Original Message ----- From: "Alfredo Rueda"
>>>> <[hidden email]>
>>>> To: [hidden email]
>>>> Sent: Monday, February 23, 2009 8:50:22 AM (GMT-0700) America/Denver
>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>
>>>>
>>>> OK, I will be glad to help you, but please could you suggest me which
>>>> Ofbiz
>>>> service you want to export?
>>>> I'm working with OpenTaps, so I don't know If OpenTaps will also have
>>>> your
>>>> web service included in their distro (OpenTaps is built upon Ofbiz??)
>>>>
>>>> Some example:
>>>>
>>>> GenericDelegator delegator =
>>>> GenericDelegator.getGenericDelegator("default");
>>>> LocalDispatcher dispatcher =
>>>> GenericDispatcher.getLocalDispatcher("default",delegator);
>>>> GenericValue admin = null;
>>>> try {
>>>> admin = delegator.findByPrimaryKey("UserLogin",
>>>> UtilMisc.toMap("userLoginId", "admin"));
>>>> } catch (GenericEntityException e1) {
>>>> e1.printStackTrace();
>>>> }
>>>>
>>>> Map result = null;
>>>>
>>>> Object[] params = {
>>>> "login.username", un_username,
>>>> "login.password", un_password,
>>>> "domini", un_domini,
>>>> .... (more params)
>>>>
>>>> "estat", un_estat,
>>>> "ip", una_ip,
>>>> "userLogin", admin
>>>> };
>>>>
>>>> try {
>>>> result = dispatcher.runSync("put here the name of your ofbiz service",
>>>> UtilMisc.toMap(params));
>>>> } catch (GenericServiceException e) {
>>>> e.printStackTrace();
>>>> }
>>>>
>>>> // Now get the result using result variable
>>>>
>>>>
>>>> Hope that helps!
>>>>
>>>>
>>>>
>>>> Vince Clark wrote:
>>>>> OK that makes sense. Yes I agree it would not make sense to publish
>>>>> custom
>>>>> services you have written for a customer. But examples of OFBiz
>>>>> standard
>>>>> services being exported would be very helpful, along with the directory
>>>>> structure, supporting files, etc. for deploying as an OFBiz
>>>>> component. For
>>>>> example, did you deploy the entire binary distribution, or just
>>>>> axis2.war?
>>>>>
>>>>> A jira issue that explains your solution along with a patch would be
>>>>> fantastic! Before doing that, would you mind just replying to this
>>>>> thread
>>>>> with a code sample showing the call to a standard OFBiz service and how
>>>>> you are dealing with the results? It would be very timely as we are
>>>>> struggling with this very thing right now.
>>>>>
>>>>> ----- Original Message ----- From: "Alfredo Rueda"
>>>>> <[hidden email]>
>>>>> To: [hidden email]
>>>>> Sent: Monday, February 23, 2009 8:23:39 AM (GMT-0700) America/Denver
>>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>>
>>>>>
>>>>> Hello Vince,
>>>>>
>>>>> Yes, I have deployed Axis2 as its own OFBiz component.
>>>>>
>>>>> "The example code
>>>>> will be a java file that exports two Ofbiz Services that come with
>>>>> Ofbiz
>>>>> Distribution (now I'm exporting customer specific Ofbiz Services,
>>>>> that is
>>>>> why it's nonsense to publish this java file.)"
>>>>>
>>>>> I meant that it's nonsense to publish an example in which I export
>>>>> customer
>>>>> specific ofbiz services, because I have to provide also a lot of
>>>>> code that
>>>>> the customer specific ofbiz service relies on, for instance, ofbiz
>>>>> service
>>>>> minilang implementation, lot of subservices, views entities, etc, etc,
>>>>> etc.
>>>>>
>>>>> The purpose is just to show how to export ofbiz services that use
>>>>> complex
>>>>> type parameters, so why not use as an example standard ofbiz
>>>>> services that
>>>>> comes with Ofbiz Distribution? This was the only thing I tried to
>>>>> explain
>>>>> before :-)
>>>>>
>>>>> Regards,
>>>>>
>>>>> Alfredo
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Vince Clark wrote:
>>>>>> Alfredo
>>>>>>
>>>>>> So to be clear, you have deployed Axis2 as its own OFBiz component? Or
>>>>>> are
>>>>>> you still using the approach of deploying the war file under an
>>>>>> existing
>>>>>> webapp directory in another component?
>>>>>>
>>>>>> A patch would be very helpful. Not sure why you think it is
>>>>>> "nonsense."
>>>>>> Working examples are extremely helpful to the community. Especially in
>>>>>> new
>>>>>> areas like this.
>>>>>>
>>>>>> To submit a patch you must create an account on Jira, then create an
>>>>>> issue
>>>>>> and attach the patch file.
>>>>>>
>>>>>> Looking forward to seeing what you have done!
>>>>>>
>>>>>> ----- Original Message ----- From: "Alfredo Rueda"
>>>>>> <[hidden email]>
>>>>>> To: [hidden email]
>>>>>> Sent: Monday, February 23, 2009 5:17:53 AM (GMT-0700) America/Denver
>>>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>>>
>>>>>>
>>>>>> Hello Jacques!
>>>>>>
>>>>>> The Axis2 Ofbiz Component is simply an Ofbiz Component that has:
>>>>>>
>>>>>> 1. Axis2 1.4 Distribution stored in a subdirectory.
>>>>>> 2. The Ofbiz build system is connected to Axis2 build system via an
>>>>>> Ant
>>>>>> build.xml file
>>>>>> 3. A java file that is a Web Services Facade to Ofbiz Services that
>>>>>> want
>>>>>> to
>>>>>> be exported.
>>>>>>
>>>>>> So, the only code that need to be published is:
>>>>>> 1. The java file that is a Web Services Facade to Ofbiz Services that
>>>>>> want
>>>>>> to be exported.
>>>>>> This file contains simply a Java Class that has 1 wrapper method for
>>>>>> each Ofbiz Service that want to be exported. Axis2 does the job of
>>>>>> exporting
>>>>>> java methods as WebServices. It's amazing!
>>>>>> 2. The build.xml of the component that builds the java file and
>>>>>> puts the
>>>>>> class file in an specific Axis2 directory
>>>>>>
>>>>>> The Ofbiz community may consider to include this ready to use Axis2
>>>>>> Ofbiz
>>>>>> component that includes Axis2 Distribution and some Ofbiz Services
>>>>>> exported
>>>>>> via SOAP as an example of use.
>>>>>>
>>>>>> So, in this case the JIRA issue could be an idea more than code
>>>>>> changes
>>>>>> of
>>>>>> existing Ofbiz code?
>>>>>> How can I publish this idea as a JIRA issue?
>>>>>> If the community thinks that is a good idea, then I will be glad to
>>>>>> provide
>>>>>> an example code (for instance 2 Ofbiz services that use complex types
>>>>>> exported via SOAP), the build.xml and the documentation. The
>>>>>> example code
>>>>>> will be a java file that exports two Ofbiz Services that come with
>>>>>> Ofbiz
>>>>>> Distribution (now I'm exporting customer specific Ofbiz Services,
>>>>>> that is
>>>>>> why It's nonsense to publish this java file.)
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Alfredo
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> jacques.le.roux wrote:
>>>>>>> Hello Alfredo,
>>>>>>>
>>>>>>> Did you create a such Axis2 component ? If yes couls you think about
>>>>>>> creating a Jira issue and submit a patch ?
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> Jacques
>>>>>>>
>>>>>>> From: "Alfredo Rueda" <[hidden email]>
>>>>>>>> Hello Dhruv!
>>>>>>>>
>>>>>>>> A collection of Ofbiz services have been exposed as Web Services
>>>>>>>> using
>>>>>>>> this
>>>>>>>> solution:
>>>>>>>>
>>>>>>>> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP 
>>>>>>>>
>>>>>>>>
>>>>>>>> These Web Services have been deployed in a production environment
>>>>>>>> and
>>>>>>>> are
>>>>>>>> working perfectly fine.
>>>>>>>>
>>>>>>>> I suggest you to follow the steps, and I will be glad to help you if
>>>>>>>> you
>>>>>>>> run
>>>>>>>> into trouble at some point in the process.
>>>>>>>>
>>>>>>>> Once you finish you can create your own Axis2 Ofbiz Component to
>>>>>>>> provide
>>>>>>>> a
>>>>>>>> cleaner solution. This Axis2 Ofbiz Component will serve as a Web
>>>>>>>> Service
>>>>>>>> Facade to comunicate Ofbiz with other systems.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>>
>>>>>>>> Alfredo Rueda
>>>>>>>>
>>>>>>>>
>>>>>>>> Dhruv Datta wrote:
>>>>>>>>> Hi Frns,
>>>>>>>>>
>>>>>>>>> I am using "wsimport" tool to read an existing WSDL file of OFBiz
>>>>>>>>> framework and want to generate artifacts. I need these because I am
>>>>>>>>> doing load testing on Web Service and retrieve data like the
>>>>>>>>> average
>>>>>>>>> time requierd to obtain the reponse from a webservice.
>>>>>>>>>
>>>>>>>>> So I've following questions:
>>>>>>>>>
>>>>>>>>> 1) How to expose the existing WebServices of the OFBiz ?
>>>>>>>>> 2) What meaningful data will these services provide?
>>>>>>>>>
>>>>>>>>> I am trying to expose a Web Service by using following syntax:
>>>>>>>>>
>>>>>>>>> E:\WSDL>wsimport -d .
>>>>>>>>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL 
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> And I am getting following error :
>>>>>>>>>
>>>>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>>>>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>>>>>>>>> document-literal operation, message part must refer to a schema
>>>>>>>>> element declaration
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Any help would be greatly appreciated.
>>>>>>>>>
>>>>>>>>> Thanks in Advance.
>>>>>>>>>
>>>>>>>>> Dhruv.
>>>>>>>>>
>>>>>>>>>
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html 
>>>>>>>>
>>>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22160487.html 
>>>>>>
>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22163567.html 
>>>>>
>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22164077.html 
>>>>
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJqY38rP3NbaWWqE4RAhFaAJoCN7BaSskKqZVsFSP77JP3cit/zgCfcYU0
iU33/DgrKsEzI2XWnq6C/j0=
=g5m7
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

Vince Clark
What service? There are no services defined for ShoppingCart. There are services for ShoppingList and we are using them.

Are you saying we should use ShoppingCartEvents instead of manipulating ShoppingCart directly?

----- Original Message -----
From: "BJ Freeman" <[hidden email]>
To: [hidden email]
Sent: Saturday, February 28, 2009 12:18:20 PM (GMT-0700) America/Denver
Subject: Re: How to expose Web Service of OFBiz ?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I am curious since you are not calling the service how all the SCAS and
ECAS are being compensated for.

Vince M. Clark sent the following on 2/28/2009 9:42 AM:

> Thanks for all the feedback on this. The ShoppingCart object is what we have been working with that originally raised the question. As we have progressed thru our learning curve of creating web services using Axis, Anthony (my coworker) figured out how to use the ShoppingCart without it being defined as a service in OFBiz. So our web service just creates a ShoppingCart object and if we need to persist it then we use ShoppingList services.
>
> ----- Original Message -----
> From: "BJ Freeman" <[hidden email]>
> To: [hidden email]
> Sent: Saturday, February 28, 2009 10:43:55 AM (GMT-0700) America/Denver
> Subject: Re: How to expose Web Service of OFBiz ?
>
> to add to this
> and event has unstructured data, where you can seed data not in the
> entities to be processed.
> where a service has structured input and output with input validation.
>
> Jacques Le Roux sent the following on 2/28/2009 9:27 AM:
>> As I see it, a (java or simple-method mostly) event is a simple response
>> to a request which does not need further processing.
>> A service allows you to use Service Engine power : chain other services
>> using SECA, etc.
>
>> Jacques
>
>> From: "Vince M. Clark" <[hidden email]>
>>> Thank you Jacques. Your suggestion raises something that I was
>>> confused about. What is different about "events" and "services?" I
>>> wasn't sure if we could just define a service as you put it, a "cover"
>>> service. Why was the event not defined as a service in the
>>> first place?
>>>
>>> I'll look thru the docs but any clarification you can provide would be
>>> appreciated.
>>>
>>> ----- Original Message ----- From: "Jacques Le Roux"
>>> <[hidden email]>
>>> To: [hidden email]
>>> Sent: Wednesday, February 25, 2009 12:59:29 PM (GMT-0600) America/Chicago
>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>
>>> Why not create cover services around events if it's your problem ?
>>> (Not sure someone did not already suggest this to you, was half
>>> somewhere else those last days...)
>>>
>>> Jacques
>>>
>>> From: "Vince M. Clark" <[hidden email]>
>>>> This helps, thank you. Your example goes further than the one in the
>>>> how to.
>>>>
>>>> Could you shed some light on this scenario? We want to use all the
>>>> shopping cart functionality and are struggling with how to put
>>>> all the pieces together.
>>>> If I use OFBiz ecommerce as a guide and trace thru the code I see
>>>> that from the ecommerce site if I click "add to cart" it calls
>>>> a
>>>> request map called "additem" in the controller.
>>>> That request map calls the following event:
>>>> <event type="java"
>>>> path="org.ofbiz.order.shoppingcart.ShoppingCartEvents"
>>>> invoke="addToCart"/>
>>>> which is not defined as a service. So we are a bit confused as to how
>>>> we can mimick the shopping cart functionality thru web
>>>> services.
>>>> Should we call ShoppingCartEvents.addToCart() directly from our java
>>>> class in Axis, and then use other methods defined as
>>>> services, such as ShoppingCartServices.getShoppingCartData() to
>>>> return up the stack?
>>>>
>>>> ----- Original Message ----- From: "Alfredo Rueda"
>>>> <[hidden email]>
>>>> To: [hidden email]
>>>> Sent: Monday, February 23, 2009 8:50:22 AM (GMT-0700) America/Denver
>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>
>>>>
>>>> OK, I will be glad to help you, but please could you suggest me which
>>>> Ofbiz
>>>> service you want to export?
>>>> I'm working with OpenTaps, so I don't know If OpenTaps will also have
>>>> your
>>>> web service included in their distro (OpenTaps is built upon Ofbiz??)
>>>>
>>>> Some example:
>>>>
>>>> GenericDelegator delegator =
>>>> GenericDelegator.getGenericDelegator("default");
>>>> LocalDispatcher dispatcher =
>>>> GenericDispatcher.getLocalDispatcher("default",delegator);
>>>> GenericValue admin = null;
>>>> try {
>>>> admin = delegator.findByPrimaryKey("UserLogin",
>>>> UtilMisc.toMap("userLoginId", "admin"));
>>>> } catch (GenericEntityException e1) {
>>>> e1.printStackTrace();
>>>> }
>>>>
>>>> Map result = null;
>>>>
>>>> Object[] params = {
>>>> "login.username", un_username,
>>>> "login.password", un_password,
>>>> "domini", un_domini,
>>>> .... (more params)
>>>>
>>>> "estat", un_estat,
>>>> "ip", una_ip,
>>>> "userLogin", admin
>>>> };
>>>>
>>>> try {
>>>> result = dispatcher.runSync("put here the name of your ofbiz service",
>>>> UtilMisc.toMap(params));
>>>> } catch (GenericServiceException e) {
>>>> e.printStackTrace();
>>>> }
>>>>
>>>> // Now get the result using result variable
>>>>
>>>>
>>>> Hope that helps!
>>>>
>>>>
>>>>
>>>> Vince Clark wrote:
>>>>> OK that makes sense. Yes I agree it would not make sense to publish
>>>>> custom
>>>>> services you have written for a customer. But examples of OFBiz
>>>>> standard
>>>>> services being exported would be very helpful, along with the directory
>>>>> structure, supporting files, etc. for deploying as an OFBiz
>>>>> component. For
>>>>> example, did you deploy the entire binary distribution, or just
>>>>> axis2.war?
>>>>>
>>>>> A jira issue that explains your solution along with a patch would be
>>>>> fantastic! Before doing that, would you mind just replying to this
>>>>> thread
>>>>> with a code sample showing the call to a standard OFBiz service and how
>>>>> you are dealing with the results? It would be very timely as we are
>>>>> struggling with this very thing right now.
>>>>>
>>>>> ----- Original Message ----- From: "Alfredo Rueda"
>>>>> <[hidden email]>
>>>>> To: [hidden email]
>>>>> Sent: Monday, February 23, 2009 8:23:39 AM (GMT-0700) America/Denver
>>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>>
>>>>>
>>>>> Hello Vince,
>>>>>
>>>>> Yes, I have deployed Axis2 as its own OFBiz component.
>>>>>
>>>>> "The example code
>>>>> will be a java file that exports two Ofbiz Services that come with
>>>>> Ofbiz
>>>>> Distribution (now I'm exporting customer specific Ofbiz Services,
>>>>> that is
>>>>> why it's nonsense to publish this java file.)"
>>>>>
>>>>> I meant that it's nonsense to publish an example in which I export
>>>>> customer
>>>>> specific ofbiz services, because I have to provide also a lot of
>>>>> code that
>>>>> the customer specific ofbiz service relies on, for instance, ofbiz
>>>>> service
>>>>> minilang implementation, lot of subservices, views entities, etc, etc,
>>>>> etc.
>>>>>
>>>>> The purpose is just to show how to export ofbiz services that use
>>>>> complex
>>>>> type parameters, so why not use as an example standard ofbiz
>>>>> services that
>>>>> comes with Ofbiz Distribution? This was the only thing I tried to
>>>>> explain
>>>>> before :-)
>>>>>
>>>>> Regards,
>>>>>
>>>>> Alfredo
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Vince Clark wrote:
>>>>>> Alfredo
>>>>>>
>>>>>> So to be clear, you have deployed Axis2 as its own OFBiz component? Or
>>>>>> are
>>>>>> you still using the approach of deploying the war file under an
>>>>>> existing
>>>>>> webapp directory in another component?
>>>>>>
>>>>>> A patch would be very helpful. Not sure why you think it is
>>>>>> "nonsense."
>>>>>> Working examples are extremely helpful to the community. Especially in
>>>>>> new
>>>>>> areas like this.
>>>>>>
>>>>>> To submit a patch you must create an account on Jira, then create an
>>>>>> issue
>>>>>> and attach the patch file.
>>>>>>
>>>>>> Looking forward to seeing what you have done!
>>>>>>
>>>>>> ----- Original Message ----- From: "Alfredo Rueda"
>>>>>> <[hidden email]>
>>>>>> To: [hidden email]
>>>>>> Sent: Monday, February 23, 2009 5:17:53 AM (GMT-0700) America/Denver
>>>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>>>
>>>>>>
>>>>>> Hello Jacques!
>>>>>>
>>>>>> The Axis2 Ofbiz Component is simply an Ofbiz Component that has:
>>>>>>
>>>>>> 1. Axis2 1.4 Distribution stored in a subdirectory.
>>>>>> 2. The Ofbiz build system is connected to Axis2 build system via an
>>>>>> Ant
>>>>>> build.xml file
>>>>>> 3. A java file that is a Web Services Facade to Ofbiz Services that
>>>>>> want
>>>>>> to
>>>>>> be exported.
>>>>>>
>>>>>> So, the only code that need to be published is:
>>>>>> 1. The java file that is a Web Services Facade to Ofbiz Services that
>>>>>> want
>>>>>> to be exported.
>>>>>> This file contains simply a Java Class that has 1 wrapper method for
>>>>>> each Ofbiz Service that want to be exported. Axis2 does the job of
>>>>>> exporting
>>>>>> java methods as WebServices. It's amazing!
>>>>>> 2. The build.xml of the component that builds the java file and
>>>>>> puts the
>>>>>> class file in an specific Axis2 directory
>>>>>>
>>>>>> The Ofbiz community may consider to include this ready to use Axis2
>>>>>> Ofbiz
>>>>>> component that includes Axis2 Distribution and some Ofbiz Services
>>>>>> exported
>>>>>> via SOAP as an example of use.
>>>>>>
>>>>>> So, in this case the JIRA issue could be an idea more than code
>>>>>> changes
>>>>>> of
>>>>>> existing Ofbiz code?
>>>>>> How can I publish this idea as a JIRA issue?
>>>>>> If the community thinks that is a good idea, then I will be glad to
>>>>>> provide
>>>>>> an example code (for instance 2 Ofbiz services that use complex types
>>>>>> exported via SOAP), the build.xml and the documentation. The
>>>>>> example code
>>>>>> will be a java file that exports two Ofbiz Services that come with
>>>>>> Ofbiz
>>>>>> Distribution (now I'm exporting customer specific Ofbiz Services,
>>>>>> that is
>>>>>> why It's nonsense to publish this java file.)
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Alfredo
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> jacques.le.roux wrote:
>>>>>>> Hello Alfredo,
>>>>>>>
>>>>>>> Did you create a such Axis2 component ? If yes couls you think about
>>>>>>> creating a Jira issue and submit a patch ?
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> Jacques
>>>>>>>
>>>>>>> From: "Alfredo Rueda" <[hidden email]>
>>>>>>>> Hello Dhruv!
>>>>>>>>
>>>>>>>> A collection of Ofbiz services have been exposed as Web Services
>>>>>>>> using
>>>>>>>> this
>>>>>>>> solution:
>>>>>>>>
>>>>>>>> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP 
>>>>>>>>
>>>>>>>>
>>>>>>>> These Web Services have been deployed in a production environment
>>>>>>>> and
>>>>>>>> are
>>>>>>>> working perfectly fine.
>>>>>>>>
>>>>>>>> I suggest you to follow the steps, and I will be glad to help you if
>>>>>>>> you
>>>>>>>> run
>>>>>>>> into trouble at some point in the process.
>>>>>>>>
>>>>>>>> Once you finish you can create your own Axis2 Ofbiz Component to
>>>>>>>> provide
>>>>>>>> a
>>>>>>>> cleaner solution. This Axis2 Ofbiz Component will serve as a Web
>>>>>>>> Service
>>>>>>>> Facade to comunicate Ofbiz with other systems.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>>
>>>>>>>> Alfredo Rueda
>>>>>>>>
>>>>>>>>
>>>>>>>> Dhruv Datta wrote:
>>>>>>>>> Hi Frns,
>>>>>>>>>
>>>>>>>>> I am using "wsimport" tool to read an existing WSDL file of OFBiz
>>>>>>>>> framework and want to generate artifacts. I need these because I am
>>>>>>>>> doing load testing on Web Service and retrieve data like the
>>>>>>>>> average
>>>>>>>>> time requierd to obtain the reponse from a webservice.
>>>>>>>>>
>>>>>>>>> So I've following questions:
>>>>>>>>>
>>>>>>>>> 1) How to expose the existing WebServices of the OFBiz ?
>>>>>>>>> 2) What meaningful data will these services provide?
>>>>>>>>>
>>>>>>>>> I am trying to expose a Web Service by using following syntax:
>>>>>>>>>
>>>>>>>>> E:\WSDL>wsimport -d .
>>>>>>>>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL 
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> And I am getting following error :
>>>>>>>>>
>>>>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>>>>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>>>>>>>>> document-literal operation, message part must refer to a schema
>>>>>>>>> element declaration
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Any help would be greatly appreciated.
>>>>>>>>>
>>>>>>>>> Thanks in Advance.
>>>>>>>>>
>>>>>>>>> Dhruv.
>>>>>>>>>
>>>>>>>>>
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html 
>>>>>>>>
>>>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22160487.html 
>>>>>>
>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22163567.html 
>>>>>
>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22164077.html 
>>>>
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org 

iD8DBQFJqY38rP3NbaWWqE4RAhFaAJoCN7BaSskKqZVsFSP77JP3cit/zgCfcYU0
iU33/DgrKsEzI2XWnq6C/j0=
=g5m7
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

BJ Freeman
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ok my perspective is from the way ofbiz does things.
so there are no objects only models and entities.
true in the java code using 1.5 there are objects defined but these are
java type objects not ofbiz objects.
The is no one entity that is the shopping cart.
Shopping cart perse is a group of order Entities.
For instance if you change or add items there is and ECAS that updates
the grand total in the orderheader entity.
if you look at the application/ordermgr/servicedef/secas.xml you will
see all of them that effect the "shopping Cart" or order entities.
Now there are a group of services that deal with those entities in the
application/ordermgr/servicedef/services_cart.xml
this group of services are define
org.ofbiz.order.shoppingcart.ShoppingCartServices

so it would seem to me the best integration is to replace the Axis
services with the services.ofbiz to call the services and events.



Vince M. Clark sent the following on 3/1/2009 12:21 PM:

> What service? There are no services defined for ShoppingCart. There are services for ShoppingList and we are using them.
>
> Are you saying we should use ShoppingCartEvents instead of manipulating ShoppingCart directly?
>
> ----- Original Message -----
> From: "BJ Freeman" <[hidden email]>
> To: [hidden email]
> Sent: Saturday, February 28, 2009 12:18:20 PM (GMT-0700) America/Denver
> Subject: Re: How to expose Web Service of OFBiz ?
>
> I am curious since you are not calling the service how all the SCAS and
> ECAS are being compensated for.
>
> Vince M. Clark sent the following on 2/28/2009 9:42 AM:
>> Thanks for all the feedback on this. The ShoppingCart object is what we have been working with that originally raised the question. As we have progressed thru our learning curve of creating web services using Axis, Anthony (my coworker) figured out how to use the ShoppingCart without it being defined as a service in OFBiz. So our web service just creates a ShoppingCart object and if we need to persist it then we use ShoppingList services.
>
>> ----- Original Message -----
>> From: "BJ Freeman" <[hidden email]>
>> To: [hidden email]
>> Sent: Saturday, February 28, 2009 10:43:55 AM (GMT-0700) America/Denver
>> Subject: Re: How to expose Web Service of OFBiz ?
>
>> to add to this
>> and event has unstructured data, where you can seed data not in the
>> entities to be processed.
>> where a service has structured input and output with input validation.
>
>> Jacques Le Roux sent the following on 2/28/2009 9:27 AM:
>>> As I see it, a (java or simple-method mostly) event is a simple response
>>> to a request which does not need further processing.
>>> A service allows you to use Service Engine power : chain other services
>>> using SECA, etc.
>>> Jacques
>>> From: "Vince M. Clark" <[hidden email]>
>>>> Thank you Jacques. Your suggestion raises something that I was
>>>> confused about. What is different about "events" and "services?" I
>>>> wasn't sure if we could just define a service as you put it, a "cover"
>>>> service. Why was the event not defined as a service in the
>>>> first place?
>>>>
>>>> I'll look thru the docs but any clarification you can provide would be
>>>> appreciated.
>>>>
>>>> ----- Original Message ----- From: "Jacques Le Roux"
>>>> <[hidden email]>
>>>> To: [hidden email]
>>>> Sent: Wednesday, February 25, 2009 12:59:29 PM (GMT-0600) America/Chicago
>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>
>>>> Why not create cover services around events if it's your problem ?
>>>> (Not sure someone did not already suggest this to you, was half
>>>> somewhere else those last days...)
>>>>
>>>> Jacques
>>>>
>>>> From: "Vince M. Clark" <[hidden email]>
>>>>> This helps, thank you. Your example goes further than the one in the
>>>>> how to.
>>>>>
>>>>> Could you shed some light on this scenario? We want to use all the
>>>>> shopping cart functionality and are struggling with how to put
>>>>> all the pieces together.
>>>>> If I use OFBiz ecommerce as a guide and trace thru the code I see
>>>>> that from the ecommerce site if I click "add to cart" it calls
>>>>> a
>>>>> request map called "additem" in the controller.
>>>>> That request map calls the following event:
>>>>> <event type="java"
>>>>> path="org.ofbiz.order.shoppingcart.ShoppingCartEvents"
>>>>> invoke="addToCart"/>
>>>>> which is not defined as a service. So we are a bit confused as to how
>>>>> we can mimick the shopping cart functionality thru web
>>>>> services.
>>>>> Should we call ShoppingCartEvents.addToCart() directly from our java
>>>>> class in Axis, and then use other methods defined as
>>>>> services, such as ShoppingCartServices.getShoppingCartData() to
>>>>> return up the stack?
>>>>>
>>>>> ----- Original Message ----- From: "Alfredo Rueda"
>>>>> <[hidden email]>
>>>>> To: [hidden email]
>>>>> Sent: Monday, February 23, 2009 8:50:22 AM (GMT-0700) America/Denver
>>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>>
>>>>>
>>>>> OK, I will be glad to help you, but please could you suggest me which
>>>>> Ofbiz
>>>>> service you want to export?
>>>>> I'm working with OpenTaps, so I don't know If OpenTaps will also have
>>>>> your
>>>>> web service included in their distro (OpenTaps is built upon Ofbiz??)
>>>>>
>>>>> Some example:
>>>>>
>>>>> GenericDelegator delegator =
>>>>> GenericDelegator.getGenericDelegator("default");
>>>>> LocalDispatcher dispatcher =
>>>>> GenericDispatcher.getLocalDispatcher("default",delegator);
>>>>> GenericValue admin = null;
>>>>> try {
>>>>> admin = delegator.findByPrimaryKey("UserLogin",
>>>>> UtilMisc.toMap("userLoginId", "admin"));
>>>>> } catch (GenericEntityException e1) {
>>>>> e1.printStackTrace();
>>>>> }
>>>>>
>>>>> Map result = null;
>>>>>
>>>>> Object[] params = {
>>>>> "login.username", un_username,
>>>>> "login.password", un_password,
>>>>> "domini", un_domini,
>>>>> .... (more params)
>>>>>
>>>>> "estat", un_estat,
>>>>> "ip", una_ip,
>>>>> "userLogin", admin
>>>>> };
>>>>>
>>>>> try {
>>>>> result = dispatcher.runSync("put here the name of your ofbiz service",
>>>>> UtilMisc.toMap(params));
>>>>> } catch (GenericServiceException e) {
>>>>> e.printStackTrace();
>>>>> }
>>>>>
>>>>> // Now get the result using result variable
>>>>>
>>>>>
>>>>> Hope that helps!
>>>>>
>>>>>
>>>>>
>>>>> Vince Clark wrote:
>>>>>> OK that makes sense. Yes I agree it would not make sense to publish
>>>>>> custom
>>>>>> services you have written for a customer. But examples of OFBiz
>>>>>> standard
>>>>>> services being exported would be very helpful, along with the directory
>>>>>> structure, supporting files, etc. for deploying as an OFBiz
>>>>>> component. For
>>>>>> example, did you deploy the entire binary distribution, or just
>>>>>> axis2.war?
>>>>>>
>>>>>> A jira issue that explains your solution along with a patch would be
>>>>>> fantastic! Before doing that, would you mind just replying to this
>>>>>> thread
>>>>>> with a code sample showing the call to a standard OFBiz service and how
>>>>>> you are dealing with the results? It would be very timely as we are
>>>>>> struggling with this very thing right now.
>>>>>>
>>>>>> ----- Original Message ----- From: "Alfredo Rueda"
>>>>>> <[hidden email]>
>>>>>> To: [hidden email]
>>>>>> Sent: Monday, February 23, 2009 8:23:39 AM (GMT-0700) America/Denver
>>>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>>>
>>>>>>
>>>>>> Hello Vince,
>>>>>>
>>>>>> Yes, I have deployed Axis2 as its own OFBiz component.
>>>>>>
>>>>>> "The example code
>>>>>> will be a java file that exports two Ofbiz Services that come with
>>>>>> Ofbiz
>>>>>> Distribution (now I'm exporting customer specific Ofbiz Services,
>>>>>> that is
>>>>>> why it's nonsense to publish this java file.)"
>>>>>>
>>>>>> I meant that it's nonsense to publish an example in which I export
>>>>>> customer
>>>>>> specific ofbiz services, because I have to provide also a lot of
>>>>>> code that
>>>>>> the customer specific ofbiz service relies on, for instance, ofbiz
>>>>>> service
>>>>>> minilang implementation, lot of subservices, views entities, etc, etc,
>>>>>> etc.
>>>>>>
>>>>>> The purpose is just to show how to export ofbiz services that use
>>>>>> complex
>>>>>> type parameters, so why not use as an example standard ofbiz
>>>>>> services that
>>>>>> comes with Ofbiz Distribution? This was the only thing I tried to
>>>>>> explain
>>>>>> before :-)
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Alfredo
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Vince Clark wrote:
>>>>>>> Alfredo
>>>>>>>
>>>>>>> So to be clear, you have deployed Axis2 as its own OFBiz component? Or
>>>>>>> are
>>>>>>> you still using the approach of deploying the war file under an
>>>>>>> existing
>>>>>>> webapp directory in another component?
>>>>>>>
>>>>>>> A patch would be very helpful. Not sure why you think it is
>>>>>>> "nonsense."
>>>>>>> Working examples are extremely helpful to the community. Especially in
>>>>>>> new
>>>>>>> areas like this.
>>>>>>>
>>>>>>> To submit a patch you must create an account on Jira, then create an
>>>>>>> issue
>>>>>>> and attach the patch file.
>>>>>>>
>>>>>>> Looking forward to seeing what you have done!
>>>>>>>
>>>>>>> ----- Original Message ----- From: "Alfredo Rueda"
>>>>>>> <[hidden email]>
>>>>>>> To: [hidden email]
>>>>>>> Sent: Monday, February 23, 2009 5:17:53 AM (GMT-0700) America/Denver
>>>>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>>>>
>>>>>>>
>>>>>>> Hello Jacques!
>>>>>>>
>>>>>>> The Axis2 Ofbiz Component is simply an Ofbiz Component that has:
>>>>>>>
>>>>>>> 1. Axis2 1.4 Distribution stored in a subdirectory.
>>>>>>> 2. The Ofbiz build system is connected to Axis2 build system via an
>>>>>>> Ant
>>>>>>> build.xml file
>>>>>>> 3. A java file that is a Web Services Facade to Ofbiz Services that
>>>>>>> want
>>>>>>> to
>>>>>>> be exported.
>>>>>>>
>>>>>>> So, the only code that need to be published is:
>>>>>>> 1. The java file that is a Web Services Facade to Ofbiz Services that
>>>>>>> want
>>>>>>> to be exported.
>>>>>>> This file contains simply a Java Class that has 1 wrapper method for
>>>>>>> each Ofbiz Service that want to be exported. Axis2 does the job of
>>>>>>> exporting
>>>>>>> java methods as WebServices. It's amazing!
>>>>>>> 2. The build.xml of the component that builds the java file and
>>>>>>> puts the
>>>>>>> class file in an specific Axis2 directory
>>>>>>>
>>>>>>> The Ofbiz community may consider to include this ready to use Axis2
>>>>>>> Ofbiz
>>>>>>> component that includes Axis2 Distribution and some Ofbiz Services
>>>>>>> exported
>>>>>>> via SOAP as an example of use.
>>>>>>>
>>>>>>> So, in this case the JIRA issue could be an idea more than code
>>>>>>> changes
>>>>>>> of
>>>>>>> existing Ofbiz code?
>>>>>>> How can I publish this idea as a JIRA issue?
>>>>>>> If the community thinks that is a good idea, then I will be glad to
>>>>>>> provide
>>>>>>> an example code (for instance 2 Ofbiz services that use complex types
>>>>>>> exported via SOAP), the build.xml and the documentation. The
>>>>>>> example code
>>>>>>> will be a java file that exports two Ofbiz Services that come with
>>>>>>> Ofbiz
>>>>>>> Distribution (now I'm exporting customer specific Ofbiz Services,
>>>>>>> that is
>>>>>>> why It's nonsense to publish this java file.)
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Alfredo
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> jacques.le.roux wrote:
>>>>>>>> Hello Alfredo,
>>>>>>>>
>>>>>>>> Did you create a such Axis2 component ? If yes couls you think about
>>>>>>>> creating a Jira issue and submit a patch ?
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>> Jacques
>>>>>>>>
>>>>>>>> From: "Alfredo Rueda" <[hidden email]>
>>>>>>>>> Hello Dhruv!
>>>>>>>>>
>>>>>>>>> A collection of Ofbiz services have been exposed as Web Services
>>>>>>>>> using
>>>>>>>>> this
>>>>>>>>> solution:
>>>>>>>>>
>>>>>>>>> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP 
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> These Web Services have been deployed in a production environment
>>>>>>>>> and
>>>>>>>>> are
>>>>>>>>> working perfectly fine.
>>>>>>>>>
>>>>>>>>> I suggest you to follow the steps, and I will be glad to help you if
>>>>>>>>> you
>>>>>>>>> run
>>>>>>>>> into trouble at some point in the process.
>>>>>>>>>
>>>>>>>>> Once you finish you can create your own Axis2 Ofbiz Component to
>>>>>>>>> provide
>>>>>>>>> a
>>>>>>>>> cleaner solution. This Axis2 Ofbiz Component will serve as a Web
>>>>>>>>> Service
>>>>>>>>> Facade to comunicate Ofbiz with other systems.
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> Alfredo Rueda
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Dhruv Datta wrote:
>>>>>>>>>> Hi Frns,
>>>>>>>>>>
>>>>>>>>>> I am using "wsimport" tool to read an existing WSDL file of OFBiz
>>>>>>>>>> framework and want to generate artifacts. I need these because I am
>>>>>>>>>> doing load testing on Web Service and retrieve data like the
>>>>>>>>>> average
>>>>>>>>>> time requierd to obtain the reponse from a webservice.
>>>>>>>>>>
>>>>>>>>>> So I've following questions:
>>>>>>>>>>
>>>>>>>>>> 1) How to expose the existing WebServices of the OFBiz ?
>>>>>>>>>> 2) What meaningful data will these services provide?
>>>>>>>>>>
>>>>>>>>>> I am trying to expose a Web Service by using following syntax:
>>>>>>>>>>
>>>>>>>>>> E:\WSDL>wsimport -d .
>>>>>>>>>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL 
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> And I am getting following error :
>>>>>>>>>>
>>>>>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>>>>>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>>>>>>>>>> document-literal operation, message part must refer to a schema
>>>>>>>>>> element declaration
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Any help would be greatly appreciated.
>>>>>>>>>>
>>>>>>>>>> Thanks in Advance.
>>>>>>>>>>
>>>>>>>>>> Dhruv.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html 
>>>>>>>>>
>>>>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>>>>>
>>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22160487.html 
>>>>>>>
>>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22163567.html 
>>>>>>
>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22164077.html 
>>>>>
>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJqxLArP3NbaWWqE4RApj4AJ0Zqdr1o/OceK7r1WyxAQM8n3LI7gCeMbIE
+vIzHF1qTUq/Qj1+yy14Jc8=
=/Gk6
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: How to expose Web Service of OFBiz ?

Vince Clark
You are correct, there are some services related to carts. But not any to create a cart if one doesn't exist.

We are using ShoppingCartEvents just like the OFBiz ecommerce controller does. But these are not services, and it is the way OFBiz does it, so I do not understand the issue you are raising about using java objects instead of services in this isolated case. I would agree that whenever there is an available service it should be used, not circumvented.

<request-map uri="additem">
<security https="false" auth="false"/>
<event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="addToCart"/>

And in the addToCart method:
ShoppingCart cart = getCartObject(request);
This method checks for an existing cart and if it doesn't exist creates a new one.

So it seems to me this is the entry point for creating a new shopping cart (not one you are creating from an existing order or shopping list.)

I do not understand the term "Shopping Cart perse" and cannot find any reference to the word in the code base. I think I understand what you are getting at regarding order services and ecas. But orders are persisted, shopping carts are not. They are not the same thing.

This is a very interesting dialog and quite a learning experience. For clarify I would like to go back to the original problem.

Create a new shopping cart object, add items to it, and go through a checkout process using web services. Why? Because we are not using OFBiz to generate the UI. We are using web frameworks like Symfony.

We are using Axis and have the first two parts working. Haven't tried to go thru checkout yet but everything we've done so far seems to be working.

So two final questions.
1) Is it correct to create the shopping cart using ShoppingCartEvents?
2) What is the difference in an event and a service. Or said another way, why are all events not defined as services?

----- Original Message -----
From: "BJ Freeman" <[hidden email]
To: [hidden email]
Sent: Sunday, March 1, 2009 3:57:05 PM (GMT-0700) America/Denver
Subject: Re: How to expose Web Service of OFBiz ?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ok my perspective is from the way ofbiz does things.
so there are no objects only models and entities.
true in the java code using 1.5 there are objects defined but these are
java type objects not ofbiz objects.
The is no one entity that is the shopping cart.
Shopping cart perse is a group of order Entities.
For instance if you change or add items there is and ECAS that updates
the grand total in the orderheader entity.
if you look at the application/ordermgr/servicedef/secas.xml you will
see all of them that effect the "shopping Cart" or order entities.
Now there are a group of services that deal with those entities in the
application/ordermgr/servicedef/services_cart.xml
this group of services are define
org.ofbiz.order.shoppingcart.ShoppingCartServices

so it would seem to me the best integration is to replace the Axis
services with the services.ofbiz to call the services and events.



Vince M. Clark sent the following on 3/1/2009 12:21 PM:

> What service? There are no services defined for ShoppingCart. There are services for ShoppingList and we are using them.
>
> Are you saying we should use ShoppingCartEvents instead of manipulating ShoppingCart directly?
>
> ----- Original Message -----
> From: "BJ Freeman" <[hidden email]>
> To: [hidden email]
> Sent: Saturday, February 28, 2009 12:18:20 PM (GMT-0700) America/Denver
> Subject: Re: How to expose Web Service of OFBiz ?
>
> I am curious since you are not calling the service how all the SCAS and
> ECAS are being compensated for.
>
> Vince M. Clark sent the following on 2/28/2009 9:42 AM:
>> Thanks for all the feedback on this. The ShoppingCart object is what we have been working with that originally raised the question. As we have progressed thru our learning curve of creating web services using Axis, Anthony (my coworker) figured out how to use the ShoppingCart without it being defined as a service in OFBiz. So our web service just creates a ShoppingCart object and if we need to persist it then we use ShoppingList services.
>
>> ----- Original Message -----
>> From: "BJ Freeman" <[hidden email]>
>> To: [hidden email]
>> Sent: Saturday, February 28, 2009 10:43:55 AM (GMT-0700) America/Denver
>> Subject: Re: How to expose Web Service of OFBiz ?
>
>> to add to this
>> and event has unstructured data, where you can seed data not in the
>> entities to be processed.
>> where a service has structured input and output with input validation.
>
>> Jacques Le Roux sent the following on 2/28/2009 9:27 AM:
>>> As I see it, a (java or simple-method mostly) event is a simple response
>>> to a request which does not need further processing.
>>> A service allows you to use Service Engine power : chain other services
>>> using SECA, etc.
>>> Jacques
>>> From: "Vince M. Clark" <[hidden email]>
>>>> Thank you Jacques. Your suggestion raises something that I was
>>>> confused about. What is different about "events" and "services?" I
>>>> wasn't sure if we could just define a service as you put it, a "cover"
>>>> service. Why was the event not defined as a service in the
>>>> first place?
>>>>
>>>> I'll look thru the docs but any clarification you can provide would be
>>>> appreciated.
>>>>
>>>> ----- Original Message ----- From: "Jacques Le Roux"
>>>> <[hidden email]>
>>>> To: [hidden email]
>>>> Sent: Wednesday, February 25, 2009 12:59:29 PM (GMT-0600) America/Chicago
>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>
>>>> Why not create cover services around events if it's your problem ?
>>>> (Not sure someone did not already suggest this to you, was half
>>>> somewhere else those last days...)
>>>>
>>>> Jacques
>>>>
>>>> From: "Vince M. Clark" <[hidden email]>
>>>>> This helps, thank you. Your example goes further than the one in the
>>>>> how to.
>>>>>
>>>>> Could you shed some light on this scenario? We want to use all the
>>>>> shopping cart functionality and are struggling with how to put
>>>>> all the pieces together.
>>>>> If I use OFBiz ecommerce as a guide and trace thru the code I see
>>>>> that from the ecommerce site if I click "add to cart" it calls
>>>>> a
>>>>> request map called "additem" in the controller.
>>>>> That request map calls the following event:
>>>>> <event type="java"
>>>>> path="org.ofbiz.order.shoppingcart.ShoppingCartEvents"
>>>>> invoke="addToCart"/>
>>>>> which is not defined as a service. So we are a bit confused as to how
>>>>> we can mimick the shopping cart functionality thru web
>>>>> services.
>>>>> Should we call ShoppingCartEvents.addToCart() directly from our java
>>>>> class in Axis, and then use other methods defined as
>>>>> services, such as ShoppingCartServices.getShoppingCartData() to
>>>>> return up the stack?
>>>>>
>>>>> ----- Original Message ----- From: "Alfredo Rueda"
>>>>> <[hidden email]>
>>>>> To: [hidden email]
>>>>> Sent: Monday, February 23, 2009 8:50:22 AM (GMT-0700) America/Denver
>>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>>
>>>>>
>>>>> OK, I will be glad to help you, but please could you suggest me which
>>>>> Ofbiz
>>>>> service you want to export?
>>>>> I'm working with OpenTaps, so I don't know If OpenTaps will also have
>>>>> your
>>>>> web service included in their distro (OpenTaps is built upon Ofbiz??)
>>>>>
>>>>> Some example:
>>>>>
>>>>> GenericDelegator delegator =
>>>>> GenericDelegator.getGenericDelegator("default");
>>>>> LocalDispatcher dispatcher =
>>>>> GenericDispatcher.getLocalDispatcher("default",delegator);
>>>>> GenericValue admin = null;
>>>>> try {
>>>>> admin = delegator.findByPrimaryKey("UserLogin",
>>>>> UtilMisc.toMap("userLoginId", "admin"));
>>>>> } catch (GenericEntityException e1) {
>>>>> e1.printStackTrace();
>>>>> }
>>>>>
>>>>> Map result = null;
>>>>>
>>>>> Object[] params = {
>>>>> "login.username", un_username,
>>>>> "login.password", un_password,
>>>>> "domini", un_domini,
>>>>> .... (more params)
>>>>>
>>>>> "estat", un_estat,
>>>>> "ip", una_ip,
>>>>> "userLogin", admin
>>>>> };
>>>>>
>>>>> try {
>>>>> result = dispatcher.runSync("put here the name of your ofbiz service",
>>>>> UtilMisc.toMap(params));
>>>>> } catch (GenericServiceException e) {
>>>>> e.printStackTrace();
>>>>> }
>>>>>
>>>>> // Now get the result using result variable
>>>>>
>>>>>
>>>>> Hope that helps!
>>>>>
>>>>>
>>>>>
>>>>> Vince Clark wrote:
>>>>>> OK that makes sense. Yes I agree it would not make sense to publish
>>>>>> custom
>>>>>> services you have written for a customer. But examples of OFBiz
>>>>>> standard
>>>>>> services being exported would be very helpful, along with the directory
>>>>>> structure, supporting files, etc. for deploying as an OFBiz
>>>>>> component. For
>>>>>> example, did you deploy the entire binary distribution, or just
>>>>>> axis2.war?
>>>>>>
>>>>>> A jira issue that explains your solution along with a patch would be
>>>>>> fantastic! Before doing that, would you mind just replying to this
>>>>>> thread
>>>>>> with a code sample showing the call to a standard OFBiz service and how
>>>>>> you are dealing with the results? It would be very timely as we are
>>>>>> struggling with this very thing right now.
>>>>>>
>>>>>> ----- Original Message ----- From: "Alfredo Rueda"
>>>>>> <[hidden email]>
>>>>>> To: [hidden email]
>>>>>> Sent: Monday, February 23, 2009 8:23:39 AM (GMT-0700) America/Denver
>>>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>>>
>>>>>>
>>>>>> Hello Vince,
>>>>>>
>>>>>> Yes, I have deployed Axis2 as its own OFBiz component.
>>>>>>
>>>>>> "The example code
>>>>>> will be a java file that exports two Ofbiz Services that come with
>>>>>> Ofbiz
>>>>>> Distribution (now I'm exporting customer specific Ofbiz Services,
>>>>>> that is
>>>>>> why it's nonsense to publish this java file.)"
>>>>>>
>>>>>> I meant that it's nonsense to publish an example in which I export
>>>>>> customer
>>>>>> specific ofbiz services, because I have to provide also a lot of
>>>>>> code that
>>>>>> the customer specific ofbiz service relies on, for instance, ofbiz
>>>>>> service
>>>>>> minilang implementation, lot of subservices, views entities, etc, etc,
>>>>>> etc.
>>>>>>
>>>>>> The purpose is just to show how to export ofbiz services that use
>>>>>> complex
>>>>>> type parameters, so why not use as an example standard ofbiz
>>>>>> services that
>>>>>> comes with Ofbiz Distribution? This was the only thing I tried to
>>>>>> explain
>>>>>> before :-)
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Alfredo
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Vince Clark wrote:
>>>>>>> Alfredo
>>>>>>>
>>>>>>> So to be clear, you have deployed Axis2 as its own OFBiz component? Or
>>>>>>> are
>>>>>>> you still using the approach of deploying the war file under an
>>>>>>> existing
>>>>>>> webapp directory in another component?
>>>>>>>
>>>>>>> A patch would be very helpful. Not sure why you think it is
>>>>>>> "nonsense."
>>>>>>> Working examples are extremely helpful to the community. Especially in
>>>>>>> new
>>>>>>> areas like this.
>>>>>>>
>>>>>>> To submit a patch you must create an account on Jira, then create an
>>>>>>> issue
>>>>>>> and attach the patch file.
>>>>>>>
>>>>>>> Looking forward to seeing what you have done!
>>>>>>>
>>>>>>> ----- Original Message ----- From: "Alfredo Rueda"
>>>>>>> <[hidden email]>
>>>>>>> To: [hidden email]
>>>>>>> Sent: Monday, February 23, 2009 5:17:53 AM (GMT-0700) America/Denver
>>>>>>> Subject: Re: How to expose Web Service of OFBiz ?
>>>>>>>
>>>>>>>
>>>>>>> Hello Jacques!
>>>>>>>
>>>>>>> The Axis2 Ofbiz Component is simply an Ofbiz Component that has:
>>>>>>>
>>>>>>> 1. Axis2 1.4 Distribution stored in a subdirectory.
>>>>>>> 2. The Ofbiz build system is connected to Axis2 build system via an
>>>>>>> Ant
>>>>>>> build.xml file
>>>>>>> 3. A java file that is a Web Services Facade to Ofbiz Services that
>>>>>>> want
>>>>>>> to
>>>>>>> be exported.
>>>>>>>
>>>>>>> So, the only code that need to be published is:
>>>>>>> 1. The java file that is a Web Services Facade to Ofbiz Services that
>>>>>>> want
>>>>>>> to be exported.
>>>>>>> This file contains simply a Java Class that has 1 wrapper method for
>>>>>>> each Ofbiz Service that want to be exported. Axis2 does the job of
>>>>>>> exporting
>>>>>>> java methods as WebServices. It's amazing!
>>>>>>> 2. The build.xml of the component that builds the java file and
>>>>>>> puts the
>>>>>>> class file in an specific Axis2 directory
>>>>>>>
>>>>>>> The Ofbiz community may consider to include this ready to use Axis2
>>>>>>> Ofbiz
>>>>>>> component that includes Axis2 Distribution and some Ofbiz Services
>>>>>>> exported
>>>>>>> via SOAP as an example of use.
>>>>>>>
>>>>>>> So, in this case the JIRA issue could be an idea more than code
>>>>>>> changes
>>>>>>> of
>>>>>>> existing Ofbiz code?
>>>>>>> How can I publish this idea as a JIRA issue?
>>>>>>> If the community thinks that is a good idea, then I will be glad to
>>>>>>> provide
>>>>>>> an example code (for instance 2 Ofbiz services that use complex types
>>>>>>> exported via SOAP), the build.xml and the documentation. The
>>>>>>> example code
>>>>>>> will be a java file that exports two Ofbiz Services that come with
>>>>>>> Ofbiz
>>>>>>> Distribution (now I'm exporting customer specific Ofbiz Services,
>>>>>>> that is
>>>>>>> why It's nonsense to publish this java file.)
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Alfredo
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> jacques.le.roux wrote:
>>>>>>>> Hello Alfredo,
>>>>>>>>
>>>>>>>> Did you create a such Axis2 component ? If yes couls you think about
>>>>>>>> creating a Jira issue and submit a patch ?
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>> Jacques
>>>>>>>>
>>>>>>>> From: "Alfredo Rueda" <[hidden email]>
>>>>>>>>> Hello Dhruv!
>>>>>>>>>
>>>>>>>>> A collection of Ofbiz services have been exposed as Web Services
>>>>>>>>> using
>>>>>>>>> this
>>>>>>>>> solution:
>>>>>>>>>
>>>>>>>>> http://docs.ofbiz.org/display/OFBIZ/Export+Ofbiz+Services+that+use+complex+type+parameters+via+SOAP 
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> These Web Services have been deployed in a production environment
>>>>>>>>> and
>>>>>>>>> are
>>>>>>>>> working perfectly fine.
>>>>>>>>>
>>>>>>>>> I suggest you to follow the steps, and I will be glad to help you if
>>>>>>>>> you
>>>>>>>>> run
>>>>>>>>> into trouble at some point in the process.
>>>>>>>>>
>>>>>>>>> Once you finish you can create your own Axis2 Ofbiz Component to
>>>>>>>>> provide
>>>>>>>>> a
>>>>>>>>> cleaner solution. This Axis2 Ofbiz Component will serve as a Web
>>>>>>>>> Service
>>>>>>>>> Facade to comunicate Ofbiz with other systems.
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> Alfredo Rueda
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Dhruv Datta wrote:
>>>>>>>>>> Hi Frns,
>>>>>>>>>>
>>>>>>>>>> I am using "wsimport" tool to read an existing WSDL file of OFBiz
>>>>>>>>>> framework and want to generate artifacts. I need these because I am
>>>>>>>>>> doing load testing on Web Service and retrieve data like the
>>>>>>>>>> average
>>>>>>>>>> time requierd to obtain the reponse from a webservice.
>>>>>>>>>>
>>>>>>>>>> So I've following questions:
>>>>>>>>>>
>>>>>>>>>> 1) How to expose the existing WebServices of the OFBiz ?
>>>>>>>>>> 2) What meaningful data will these services provide?
>>>>>>>>>>
>>>>>>>>>> I am trying to expose a Web Service by using following syntax:
>>>>>>>>>>
>>>>>>>>>> E:\WSDL>wsimport -d .
>>>>>>>>>> http://localhost:8080/webtools/control/SOAPService/cancelScheduledJob?WSDL 
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> And I am getting following error :
>>>>>>>>>>
>>>>>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>>>>>> warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
>>>>>>>>>> allowed in doc/lit for soapbind:body: "cancelScheduledJob"
>>>>>>>>>> error: Invalid wsdl:operation "cancelScheduledJob": its a
>>>>>>>>>> document-literal operation, message part must refer to a schema
>>>>>>>>>> element declaration
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Any help would be greatly appreciated.
>>>>>>>>>>
>>>>>>>>>> Thanks in Advance.
>>>>>>>>>>
>>>>>>>>>> Dhruv.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22158082.html 
>>>>>>>>>
>>>>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>>>>>
>>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22160487.html 
>>>>>>>
>>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22163567.html 
>>>>>>
>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/How-to-expose-Web-Service-of-OFBiz---tp22077891p22164077.html 
>>>>>
>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org 

iD8DBQFJqxLArP3NbaWWqE4RApj4AJ0Zqdr1o/OceK7r1WyxAQM8n3LI7gCeMbIE
+vIzHF1qTUq/Qj1+yy14Jc8=
=/Gk6
-----END PGP SIGNATURE-----
12