You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Alfredo Rueda <al...@opentrends.net> on 2008/11/20 13:12:51 UTC

Re: Using SOAP complex types with OfBiz

Hello Michael!

Have you manage to handle arrays of objects as output parameters of an ofbiz
service exported via soap?

Thank you very much!

Alfredo


Michael Imhof wrote:
> 
> After a while a found a way to create and process SOAP request
> with complex types in OfBiz:
> 
> 1). Use Java2WSDL to create a WSDL. This allows you to use complex types.
>     javac: Compile the class with option -g to get debug infos (e.g. real
> argument names instead of arg0, arg1,...)
>     Java2WSDL: Use parameter -A OPERATION.
> 
> 2). Property: axis.doAutoTypes should be true. If not, no serializer could
> be found.
>      I put this in Start.java:
>        System.setProperty("axis.doAutoTypes", Boolean.TRUE.toString());
> 
> 3). The complex type class should implement:
>            public static org.apache.axis.description.TypeDesc
> getTypeDesc():
>      For a class ComplexType with a string attribute <name>, TypeDesc
> should look like this:
> 
>      org.apache.axis.description.TypeDesc typeDesc =new
> org.apache.axis.description.TypeDesc(ComplexTest.class, true);
>      typeDesc.setXmlType(new
> javax.xml.namespace.QName("http://types.archiv.isgate.nowhow.ch",
> "ComplexTest"));
>      org.apache.axis.description.ElementDesc elemField = new
> org.apache.axis.description.ElementDesc();
>      elemField.setFieldName("name");
>      elemField.setXmlName(new javax.xml.namespace.QName("", "name"));
>      elemField.setXmlType(new
> javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
>      typeDesc.addFieldDesc(elemField);
> 
> Now you can generate Services with a complex type ComplexType. 
>     <service name="testService" engine="java"
> location="ch.nowhow.isgate.archiv.ArchivServices"
>         invoke="testService" export="true">
>         <namespace>http://nowhow.ch/isgate/</namespace>
>         <attribute name="inList"
> type="ch.nowhow.isgate.archiv.types.ComplexTest" mode="IN"
>             optional="false"/>
>     </service>
> 
> If you want to use arrays of complex types (or simply array of string),
> you should enhance ObjectType.java to support arrays...but this is another
> story and
> I'm still testing my changes
> (https://issues.apache.org/jira/browse/OFBIZ-746):-)
> 
> Regards 
> Michael
> 

-- 
View this message in context: http://www.nabble.com/Using-SOAP-complex-types-with-OfBiz-tp9180865p20599926.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: Using SOAP complex types with OfBiz

Posted by Michael Imhof <mi...@nowhow.ch>.
Please try to develop SOAP service calls step by step. It seems to me that
you're searching for
a overall solution wich I can't provide because it's too complicated (too
many classes involved and
our OfBiz version is 2years old!!).

1) Are you able to generate WSDL-Files out of ofbiz service definitions? The
generated WSDL-Files should be WS-I conformant to make sure the're working
with C++, .NET, etc Clients.
If you're not able to generate the WSDL Files, have a look at Java2WSDL from
Axis.

2) Are you able to call an ofbiz SOAP service from outside of Ofbiz? 
I'm testing my SOAP services over a .NET client.

3) Are you able to call an ofbiz SOAP service with complex types?

If you reach this point and you're able to call SOAP services with complex
types, then the array
should work too. (This is only a guess because I'm far away from the current
(trunk) release 
of Ofbiz).

Just try to break down the problem in smaller problems then I will be
probably able to help...

Regards
Michael
-- 
View this message in context: http://www.nabble.com/Using-SOAP-complex-types-with-OfBiz-tp9180865p20655844.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: Using SOAP complex types with OfBiz

Posted by Alfredo Rueda <al...@opentrends.net>.
Hi Michael,

I'm sorry but I'm a bit confused.
I don't know how to relate the instructions that you provided in the first
post to accomplish the task of passing an object as a parameter with the
ones that you are pointing now to return an array of objects.
In order to return an array of objects, Should I still follow the
instructions that you provided in the first place?
If so, would you be so kind of provide an extended version of the
instructions, please?
Thank you very much

Michael Imhof wrote:
> 
> Hi Alfredo,
> 
> we're using successfully arrays of objects in SOAP services. 
> The ObjectType.class in the trunk should support arrays
> (https://issues.apache.org/jira/browse/OFBIZ-1008).
> 
> This should work for simple data types. If you're using complex types then
> it will be more
> complicated because you have to register the
> BeanSerializer/BeanDeserializer for the type.
> Set a breakpoint in the method SOAPEventHandler.invoke(..) and try to
> understand what
> happens there... 
> 
> Regards,
> Michael
> 
> 
> 
> Alfredo Rueda wrote:
>> 
>> Hello Michael!
>> 
>> Have you manage to handle arrays of objects as output parameters of an
>> ofbiz service exported via soap?
>> 
>> Thank you very much!
>> 
>> Alfredo
>> 
>> 
>> Michael Imhof wrote:
>>> 
>>> After a while a found a way to create and process SOAP request
>>> with complex types in OfBiz:
>>> 
>>> 1). Use Java2WSDL to create a WSDL. This allows you to use complex
>>> types.
>>>     javac: Compile the class with option -g to get debug infos (e.g.
>>> real argument names instead of arg0, arg1,...)
>>>     Java2WSDL: Use parameter -A OPERATION.
>>> 
>>> 2). Property: axis.doAutoTypes should be true. If not, no serializer
>>> could be found.
>>>      I put this in Start.java:
>>>        System.setProperty("axis.doAutoTypes", Boolean.TRUE.toString());
>>> 
>>> 3). The complex type class should implement:
>>>            public static org.apache.axis.description.TypeDesc
>>> getTypeDesc():
>>>      For a class ComplexType with a string attribute <name>, TypeDesc
>>> should look like this:
>>> 
>>>      org.apache.axis.description.TypeDesc typeDesc =new
>>> org.apache.axis.description.TypeDesc(ComplexTest.class, true);
>>>      typeDesc.setXmlType(new
>>> javax.xml.namespace.QName("http://types.archiv.isgate.nowhow.ch",
>>> "ComplexTest"));
>>>      org.apache.axis.description.ElementDesc elemField = new
>>> org.apache.axis.description.ElementDesc();
>>>      elemField.setFieldName("name");
>>>      elemField.setXmlName(new javax.xml.namespace.QName("", "name"));
>>>      elemField.setXmlType(new
>>> javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
>>> "string"));
>>>      typeDesc.addFieldDesc(elemField);
>>> 
>>> Now you can generate Services with a complex type ComplexType. 
>>>     <service name="testService" engine="java"
>>> location="ch.nowhow.isgate.archiv.ArchivServices"
>>>         invoke="testService" export="true">
>>>         <namespace>http://nowhow.ch/isgate/</namespace>
>>>         <attribute name="inList"
>>> type="ch.nowhow.isgate.archiv.types.ComplexTest" mode="IN"
>>>             optional="false"/>
>>>     </service>
>>> 
>>> If you want to use arrays of complex types (or simply array of string),
>>> you should enhance ObjectType.java to support arrays...but this is
>>> another story and
>>> I'm still testing my changes
>>> (https://issues.apache.org/jira/browse/OFBIZ-746):-)
>>> 
>>> Regards 
>>> Michael
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-SOAP-complex-types-with-OfBiz-tp9180865p20628539.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: Using SOAP complex types with OfBiz

Posted by Michael Imhof <mi...@nowhow.ch>.
Hi Alfredo,

we're using successfully arrays of objects in SOAP services. 
The ObjectType.class in the trunk should support arrays
(https://issues.apache.org/jira/browse/OFBIZ-1008).

This should work for simple data types. If you're using complex types then
it will be more
complicated because you have to register the BeanSerializer/BeanDeserializer
for the type.
Set a breakpoint in the method SOAPEventHandler.invoke(..) and try to
understand what
happens there... 

Regards,
Michael



Alfredo Rueda wrote:
> 
> Hello Michael!
> 
> Have you manage to handle arrays of objects as output parameters of an
> ofbiz service exported via soap?
> 
> Thank you very much!
> 
> Alfredo
> 
> 
> Michael Imhof wrote:
>> 
>> After a while a found a way to create and process SOAP request
>> with complex types in OfBiz:
>> 
>> 1). Use Java2WSDL to create a WSDL. This allows you to use complex types.
>>     javac: Compile the class with option -g to get debug infos (e.g. real
>> argument names instead of arg0, arg1,...)
>>     Java2WSDL: Use parameter -A OPERATION.
>> 
>> 2). Property: axis.doAutoTypes should be true. If not, no serializer
>> could be found.
>>      I put this in Start.java:
>>        System.setProperty("axis.doAutoTypes", Boolean.TRUE.toString());
>> 
>> 3). The complex type class should implement:
>>            public static org.apache.axis.description.TypeDesc
>> getTypeDesc():
>>      For a class ComplexType with a string attribute <name>, TypeDesc
>> should look like this:
>> 
>>      org.apache.axis.description.TypeDesc typeDesc =new
>> org.apache.axis.description.TypeDesc(ComplexTest.class, true);
>>      typeDesc.setXmlType(new
>> javax.xml.namespace.QName("http://types.archiv.isgate.nowhow.ch",
>> "ComplexTest"));
>>      org.apache.axis.description.ElementDesc elemField = new
>> org.apache.axis.description.ElementDesc();
>>      elemField.setFieldName("name");
>>      elemField.setXmlName(new javax.xml.namespace.QName("", "name"));
>>      elemField.setXmlType(new
>> javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
>>      typeDesc.addFieldDesc(elemField);
>> 
>> Now you can generate Services with a complex type ComplexType. 
>>     <service name="testService" engine="java"
>> location="ch.nowhow.isgate.archiv.ArchivServices"
>>         invoke="testService" export="true">
>>         <namespace>http://nowhow.ch/isgate/</namespace>
>>         <attribute name="inList"
>> type="ch.nowhow.isgate.archiv.types.ComplexTest" mode="IN"
>>             optional="false"/>
>>     </service>
>> 
>> If you want to use arrays of complex types (or simply array of string),
>> you should enhance ObjectType.java to support arrays...but this is
>> another story and
>> I'm still testing my changes
>> (https://issues.apache.org/jira/browse/OFBIZ-746):-)
>> 
>> Regards 
>> Michael
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-SOAP-complex-types-with-OfBiz-tp9180865p20617645.html
Sent from the OFBiz - User mailing list archive at Nabble.com.