ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alfredo Rueda <alfredo.ru...@opentrends.net>
Subject Re: How to expose Web Service of OFBiz ?
Date Mon, 23 Feb 2009 15:50:22 GMT

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" <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. 
> 
> 
> 

-- 
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.


Mime
View raw message