Calling services from external applications

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

Calling services from external applications

Andrew Crowe
Hi

   We are currently piloting using ofbiz as the back end to some of our
systems.  One of these is a web site for an association.  What we need
to do is to allow that web site to access the data in ofbiz.  Not only
read, but also write new data to it.  The web site is a java/jsp
application.

We have created the entities and services required in Ofbiz, and can get
access to the services.  I have tried using the web service interface to
add data, and this works fine as long as I only use simple types such as
String (xsd:string).  However, one of the things that we have is a date
field.  We have set this up as a java.sql.Date as defined in the
'fieldtypemysql.xml' file.  However, when sending this as soap ofbiz
thinks that the java.sql.Date is a java.util.Date, and so throws an
error.  This is due to roundtripping issues.

We have then tried changing the type to java.util.Date in the entity and
fieldtype defs.  This results in the web service working.  However, then
when creating the entity through the ofbiz interface I get...

The Following Errors Occurred:

   * Type conversion of field [dateSetup] to type [java.util.Date]
failed for value "2007-14-14": org.ofbiz.base.util.GeneralException:
Conversion from String to java.util.Date not currently supported
   * Type conversion of field [dateSetup] to type [java.util.Date]
failed for value "2007-14-14": org.ofbiz.base.util.GeneralException:
Conversion from String to java.util.Date not currently supported

I'm also concerned with this approach as it is altering the core defs
and will break everything else!

Looking at other ofbiz services it uses java.sql.Timestamp objects for
the type.  However, this will also not roundtrip, and comes back as a
Calendar object!

I have also tried to get the wsdl to use for services that use types
other than 'string', but an error is thrown saying that ofbiz cant
handle them!

So the question really is....  How do I set up the web service (ofbiz
and cremote client) to use the correct data type that will work to
create the date?  There are a lot of examples I have found, but they
only deal with strings!

I have also tried RMI, but I could not get this to work from the remote
application.

If anyone has any information on how best to call an ofbiz service from
a remote application (including dates) then I would be most gratefull

Many thanks in advance

 

Reply | Threaded
Open this post in threaded view
|

Re: Calling services from external applications

Brett
What kind of error did you get with the RMI attempt?

I like using the RMI interface because is handles the object
conversion seamlessly.  If the two web applications are in the same
intranet RMI is a good solution.

Brett

On 5/4/07, Andrew Crowe <[hidden email]> wrote:

> Hi
>
>    We are currently piloting using ofbiz as the back end to some of our
> systems.  One of these is a web site for an association.  What we need
> to do is to allow that web site to access the data in ofbiz.  Not only
> read, but also write new data to it.  The web site is a java/jsp
> application.
>
> We have created the entities and services required in Ofbiz, and can get
> access to the services.  I have tried using the web service interface to
> add data, and this works fine as long as I only use simple types such as
> String (xsd:string).  However, one of the things that we have is a date
> field.  We have set this up as a java.sql.Date as defined in the
> 'fieldtypemysql.xml' file.  However, when sending this as soap ofbiz
> thinks that the java.sql.Date is a java.util.Date, and so throws an
> error.  This is due to roundtripping issues.
>
> We have then tried changing the type to java.util.Date in the entity and
> fieldtype defs.  This results in the web service working.  However, then
> when creating the entity through the ofbiz interface I get...
>
> The Following Errors Occurred:
>
>    * Type conversion of field [dateSetup] to type [java.util.Date]
> failed for value "2007-14-14": org.ofbiz.base.util.GeneralException:
> Conversion from String to java.util.Date not currently supported
>    * Type conversion of field [dateSetup] to type [java.util.Date]
> failed for value "2007-14-14": org.ofbiz.base.util.GeneralException:
> Conversion from String to java.util.Date not currently supported
>
> I'm also concerned with this approach as it is altering the core defs
> and will break everything else!
>
> Looking at other ofbiz services it uses java.sql.Timestamp objects for
> the type.  However, this will also not roundtrip, and comes back as a
> Calendar object!
>
> I have also tried to get the wsdl to use for services that use types
> other than 'string', but an error is thrown saying that ofbiz cant
> handle them!
>
> So the question really is....  How do I set up the web service (ofbiz
> and cremote client) to use the correct data type that will work to
> create the date?  There are a lot of examples I have found, but they
> only deal with strings!
>
> I have also tried RMI, but I could not get this to work from the remote
> application.
>
> If anyone has any information on how best to call an ofbiz service from
> a remote application (including dates) then I would be most gratefull
>
> Many thanks in advance
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Calling services from external applications

Shi Yusen
In reply to this post by Andrew Crowe
Hi Andrew,

> I have also tried RMI, but I could not get this to work from the remote
> application.
>
> If anyone has any information on how best to call an ofbiz service from
> a remote application (including dates) then I would be most gratefull
>
RMI can work perfectly. I guess you cannot pass the ssl shakehands
procedure. If so, try my script to create your own jks files. Perhaps
you haven't read my former email. I copy it here:

I just uploaded the source code and OpenCms module to sourceforge.net:
https://sourceforge.net/projects/opencms-ofbiz

Using this module, you can setup an opencms ecommerce website easily.

There are 3 major pathes under /opencms-ofbiz/trunk/ in cvs:
rmiclient: there's an opencms module file in rmiclient/moduels/. The rmi
client source code is under this folder.

rmiservice: copy this fold to ${ofbiz-home}/specialpurpose/ and add to
ofbiz as a module and rebuild ofbiz.

sslcert: create jks files for RMI server and client.

Currently, the code is in the cvs.

Regards,

Shi Yusen/Beijing Langhua Ltd.


Reply | Threaded
Open this post in threaded view
|

Re: Calling services from external applications

Andrew Crowe
In reply to this post by Brett
Many thanks for the response.

    The main stumbling block that I came across was a
"java.net.SocketException: Socket is not connected" error!  This may
well be a firewall or certificate issue though, but all relevant ports
seem to be opened.  If you have come across this, or know what may be
causing it I would be most grateful.

I have now however tested my client on the same machine that the ofbiz
server is on and everything works just fine...  I agree that this is the
best solution as we can pass objects seamlessly, and relatively
quickly.  My only concern is that when we have more distributed services
we will want to communicate cross machines.  Although these machines
will still be behind the same part of the network behind a firewall.

If we ever want to access the services from a completely remote location
(not sure if we would actually ever want this though!) then web services
would be the way to go.  However, if we are using complex types that
ofbiz cant handle then we may be stuck!

Many thanks

Andrew Crowe

Brett Palmer wrote:

> What kind of error did you get with the RMI attempt?
>
> I like using the RMI interface because is handles the object
> conversion seamlessly.  If the two web applications are in the same
> intranet RMI is a good solution.
>
> Brett
>
> On 5/4/07, Andrew Crowe <[hidden email]> wrote:
>> Hi
>>
>>    We are currently piloting using ofbiz as the back end to some of our
>> systems.  One of these is a web site for an association.  What we need
>> to do is to allow that web site to access the data in ofbiz.  Not only
>> read, but also write new data to it.  The web site is a java/jsp
>> application.
>>
>> We have created the entities and services required in Ofbiz, and can get
>> access to the services.  I have tried using the web service interface to
>> add data, and this works fine as long as I only use simple types such as
>> String (xsd:string).  However, one of the things that we have is a date
>> field.  We have set this up as a java.sql.Date as defined in the
>> 'fieldtypemysql.xml' file.  However, when sending this as soap ofbiz
>> thinks that the java.sql.Date is a java.util.Date, and so throws an
>> error.  This is due to roundtripping issues.
>>
>> We have then tried changing the type to java.util.Date in the entity and
>> fieldtype defs.  This results in the web service working.  However, then
>> when creating the entity through the ofbiz interface I get...
>>
>> The Following Errors Occurred:
>>
>>    * Type conversion of field [dateSetup] to type [java.util.Date]
>> failed for value "2007-14-14": org.ofbiz.base.util.GeneralException:
>> Conversion from String to java.util.Date not currently supported
>>    * Type conversion of field [dateSetup] to type [java.util.Date]
>> failed for value "2007-14-14": org.ofbiz.base.util.GeneralException:
>> Conversion from String to java.util.Date not currently supported
>>
>> I'm also concerned with this approach as it is altering the core defs
>> and will break everything else!
>>
>> Looking at other ofbiz services it uses java.sql.Timestamp objects for
>> the type.  However, this will also not roundtrip, and comes back as a
>> Calendar object!
>>
>> I have also tried to get the wsdl to use for services that use types
>> other than 'string', but an error is thrown saying that ofbiz cant
>> handle them!
>>
>> So the question really is....  How do I set up the web service (ofbiz
>> and cremote client) to use the correct data type that will work to
>> create the date?  There are a lot of examples I have found, but they
>> only deal with strings!
>>
>> I have also tried RMI, but I could not get this to work from the remote
>> application.
>>
>> If anyone has any information on how best to call an ofbiz service from
>> a remote application (including dates) then I would be most gratefull
>>
>> Many thanks in advance
>>
>>
>>
>>
>
>
 

Reply | Threaded
Open this post in threaded view
|

Re: Calling services from external applications

Andrew Crowe
In reply to this post by Shi Yusen
Thats great thanks.

    I agree that my problems were probably certificate or firewall
problems as I have now tested my client on the same machine that the
ofbiz server is on and everything works just fine...

Many thank for your information.  I'll give it a go and then retry on a
machine other than that that ofbiz is running on.

Andrew Crowe

Shi Yusen wrote:

> Hi Andrew,
>
>  
>> I have also tried RMI, but I could not get this to work from the remote
>> application.
>>
>> If anyone has any information on how best to call an ofbiz service from
>> a remote application (including dates) then I would be most gratefull
>>
>>    
> RMI can work perfectly. I guess you cannot pass the ssl shakehands
> procedure. If so, try my script to create your own jks files. Perhaps
> you haven't read my former email. I copy it here:
>
> I just uploaded the source code and OpenCms module to sourceforge.net:
> https://sourceforge.net/projects/opencms-ofbiz
>
> Using this module, you can setup an opencms ecommerce website easily.
>
> There are 3 major pathes under /opencms-ofbiz/trunk/ in cvs:
> rmiclient: there's an opencms module file in rmiclient/moduels/. The rmi
> client source code is under this folder.
>
> rmiservice: copy this fold to ${ofbiz-home}/specialpurpose/ and add to
> ofbiz as a module and rebuild ofbiz.
>
> sslcert: create jks files for RMI server and client.
>
> Currently, the code is in the cvs.
>
> Regards,
>
> Shi Yusen/Beijing Langhua Ltd.
>
>
>  
Reply | Threaded
Open this post in threaded view
|

Re: Calling services from external applications

Shi Yusen
In reply to this post by Andrew Crowe
> If we ever want to access the services from a completely remote location
> (not sure if we would actually ever want this though!) then web services
> would be the way to go.  However, if we are using complex types that
> ofbiz cant handle then we may be stuck!
I guess sooner or later somebody will meet such a requirement. I hope
OFBiz can support not only java, but also php/.net.

Regards,

Shi Yusen/Beijing Langhua Ltd.


Reply | Threaded
Open this post in threaded view
|

Re: Calling services from external applications

Jacques Le Roux
Administrator
In reply to this post by Andrew Crowe
Andrew,

De : "Andrew Crowe" <[hidden email]>

> If we ever want to access the services from a completely remote
location
> (not sure if we would actually ever want this though!) then web
services
> would be the way to go.  However, if we are using complex types that
> ofbiz cant handle then we may be stuck!

I never used it yet but i seems that using Axis's Java2WDSL should be
the way
http://ws.apache.org/axis/java/user-guide.html#UsingWSDLWithAxis

You may also find these 2 links interesting :
http://tinyurl.com/2euxsu
http://tinyurl.com/36hxa8

Jacques


Reply | Threaded
Open this post in threaded view
|

Re: Calling services from external applications

Jean-Sébastien HEDERER
We (ASPERIENCE) have tried to develop a JSR168 portlet accessing some
services through SOAP in order to validate a tutorial found on a related
ofbiz site and we've failed to make it run.

But we had'nt found the 2 URLS below. Perhaps is there a solution.

"Jacques Le Roux" a écrit le 04/05/2007 19:24 :

> Andrew,
>
> De : "Andrew Crowe" <[hidden email]>
>
>  
>> If we ever want to access the services from a completely remote
>>    
> location
>  
>> (not sure if we would actually ever want this though!) then web
>>    
> services
>  
>> would be the way to go.  However, if we are using complex types that
>> ofbiz cant handle then we may be stuck!
>>    
>
> I never used it yet but i seems that using Axis's Java2WDSL should be
> the way
> http://ws.apache.org/axis/java/user-guide.html#UsingWSDLWithAxis
>
> You may also find these 2 links interesting :
> http://tinyurl.com/2euxsu
> http://tinyurl.com/36hxa8
>
> Jacques
>
>
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: Calling services from external applications

Jacques Le Roux
Administrator
Hi Jean-Sébastien,

Did you try to use Axis's Java2WDSL ?

Jacques

----- Message d'origine -----
De : "Jean-Sébastien Hederer" <[hidden email]>
À : <[hidden email]>
Envoyé : vendredi 4 mai 2007 22:56
Objet : Re: Calling services from external applications


> We (ASPERIENCE) have tried to develop a JSR168 portlet accessing some
> services through SOAP in order to validate a tutorial found on a
related

> ofbiz site and we've failed to make it run.
>
> But we had'nt found the 2 URLS below. Perhaps is there a solution.
>
> "Jacques Le Roux" a écrit le 04/05/2007 19:24 :
> > Andrew,
> >
> > De : "Andrew Crowe" <[hidden email]>
> >
> >
> >> If we ever want to access the services from a completely remote
> >>
> > location
> >
> >> (not sure if we would actually ever want this though!) then web
> >>
> > services
> >
> >> would be the way to go.  However, if we are using complex types
that
> >> ofbiz cant handle then we may be stuck!
> >>
> >
> > I never used it yet but i seems that using Axis's Java2WDSL should
be

> > the way
> > http://ws.apache.org/axis/java/user-guide.html#UsingWSDLWithAxis
> >
> > You may also find these 2 links interesting :
> > http://tinyurl.com/2euxsu
> > http://tinyurl.com/36hxa8
> >
> > Jacques
> >
> >
> >
> >
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Calling services from external applications

Andrew Crowe
Hi Jacques,

    I have not tried Java2WSDL for this as I was hoping that ofbiz would
handle this already.  I have used this in the past though, and it is
very good.

Many thanks

Andrew.

Jacques Le Roux wrote:

> Hi Jean-Sébastien,
>
> Did you try to use Axis's Java2WDSL ?
>
> Jacques
>
> ----- Message d'origine -----
> De : "Jean-Sébastien Hederer" <[hidden email]>
> À : <[hidden email]>
> Envoyé : vendredi 4 mai 2007 22:56
> Objet : Re: Calling services from external applications
>
>
>  
>> We (ASPERIENCE) have tried to develop a JSR168 portlet accessing some
>> services through SOAP in order to validate a tutorial found on a
>>    
> related
>  
>> ofbiz site and we've failed to make it run.
>>
>> But we had'nt found the 2 URLS below. Perhaps is there a solution.
>>
>> "Jacques Le Roux" a écrit le 04/05/2007 19:24 :
>>    
>>> Andrew,
>>>
>>> De : "Andrew Crowe" <[hidden email]>
>>>
>>>
>>>      
>>>> If we ever want to access the services from a completely remote
>>>>
>>>>        
>>> location
>>>
>>>      
>>>> (not sure if we would actually ever want this though!) then web
>>>>
>>>>        
>>> services
>>>
>>>      
>>>> would be the way to go.  However, if we are using complex types
>>>>        
> that
>  
>>>> ofbiz cant handle then we may be stuck!
>>>>
>>>>        
>>> I never used it yet but i seems that using Axis's Java2WDSL should
>>>      
> be
>  
>>> the way
>>> http://ws.apache.org/axis/java/user-guide.html#UsingWSDLWithAxis
>>>
>>> You may also find these 2 links interesting :
>>> http://tinyurl.com/2euxsu
>>> http://tinyurl.com/36hxa8
>>>
>>> Jacques
>>>
>>>
>>>
>>>
>>>      
>>    
>
>
>  
 

Reply | Threaded
Open this post in threaded view
|

Re: Calling services from external applications

Jacques Le Roux
Administrator
Andrew,

Currently OFBiz only handle simple type (not complex type). There are
also some troubles if you want to use document type (not RPC)

You may be interested by this link  http://tinyurl.com/yqsqro

Jacques

----- Message d'origine -----
De : "Andrew Crowe" <[hidden email]>
À : <[hidden email]>
Envoyé : mardi 8 mai 2007 10:44
Objet : Re: Calling services from external applications


> Hi Jacques,
>
>     I have not tried Java2WSDL for this as I was hoping that ofbiz
would

> handle this already.  I have used this in the past though, and it is
> very good.
>
> Many thanks
>
> Andrew.
>
> Jacques Le Roux wrote:
> > Hi Jean-Sébastien,
> >
> > Did you try to use Axis's Java2WDSL ?
> >
> > Jacques
> >
> > ----- Message d'origine -----
> > De : "Jean-Sébastien Hederer" <[hidden email]>
> > À : <[hidden email]>
> > Envoyé : vendredi 4 mai 2007 22:56
> > Objet : Re: Calling services from external applications
> >
> >
> >
> >> We (ASPERIENCE) have tried to develop a JSR168 portlet accessing
some

> >> services through SOAP in order to validate a tutorial found on a
> >>
> > related
> >
> >> ofbiz site and we've failed to make it run.
> >>
> >> But we had'nt found the 2 URLS below. Perhaps is there a solution.
> >>
> >> "Jacques Le Roux" a écrit le 04/05/2007 19:24 :
> >>
> >>> Andrew,
> >>>
> >>> De : "Andrew Crowe" <[hidden email]>
> >>>
> >>>
> >>>
> >>>> If we ever want to access the services from a completely remote
> >>>>
> >>>>
> >>> location
> >>>
> >>>
> >>>> (not sure if we would actually ever want this though!) then web
> >>>>
> >>>>
> >>> services
> >>>
> >>>
> >>>> would be the way to go.  However, if we are using complex types
> >>>>
> > that
> >
> >>>> ofbiz cant handle then we may be stuck!
> >>>>
> >>>>
> >>> I never used it yet but i seems that using Axis's Java2WDSL should
> >>>
> > be
> >
> >>> the way
> >>> http://ws.apache.org/axis/java/user-guide.html#UsingWSDLWithAxis
> >>>
> >>> You may also find these 2 links interesting :
> >>> http://tinyurl.com/2euxsu
> >>> http://tinyurl.com/36hxa8
> >>>
> >>> Jacques
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >
> >
> >
>
>
>