You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by siddhartha <si...@yahoo.com> on 2008/06/17 13:28:05 UTC

Re: Using SOAP complex types with OfBiz

Hello All ,

I tried the same with ofbiz R 607122 . I first created the wsdl using
Java2WSDL . Then I tried 
to access the deployed webservice :

My service def looks like the following :

<service name="createHelloPerson" engine="java"
   location="org.ofbiz.hello3.Hello3Services" invoke="createHelloPerson"
export="true">
        <description>Create a HelloPerson</description> 
		  <namespace>http://home.com</namespace>        
		<attribute name="personTwo" mode="IN" type="org.ofbiz.hello3.ComplexTest"
optional="true"/>			    </service>

my SoapMessage :

<soap:Body>
<createHelloPerson>
<personTwo xsi:type=\"xsd:complexType\">
<name xsi:type=\"xsd:attribute\">peters</name>
</personTwo></createHelloPerson></soap:Body></soap:Envelope>

Can any Body tell me whether I am using the proper soap message or not?As I
am getting the following 
exception 

 [     RequestHandler.java:314:
ERROR] Request SOAPService caused an error with the following message: Error
calling
event: org.ofbiz.webapp.event.EventHandlerException:
org.xml.sax.SAXException (org.xm
l.sax.SAXException)

thx in advance 
SiddharthaC




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-tp9180865p17886201.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 SiddharthaC,

looks like you're using the wrong binding. I use the following parameters to
generate my
wsdl with Java2WSDL:
-A OPERATION
-y WRAPPED
-u LITERAL

Regards
Michael



siddhartha wrote:
> 
> Hello All ,
> 
> I tried the same with ofbiz R 607122 . I first created the wsdl using
> Java2WSDL . Then I tried 
> to access the deployed webservice :
> 
> My service def looks like the following :
> 
> <service name="createHelloPerson" engine="java"
>    location="org.ofbiz.hello3.Hello3Services" invoke="createHelloPerson"
> export="true">
>         <description>Create a HelloPerson</description> 
> 		  <namespace>http://home.com</namespace>        
> 		<attribute name="personTwo" mode="IN"
> type="org.ofbiz.hello3.ComplexTest" optional="true"/>			    </service>
> 
> my SoapMessage :
> 
> <soap:Body>
> <createHelloPerson>
> <personTwo xsi:type=\"xsd:complexType\">
> <name xsi:type=\"xsd:attribute\">peters</name>
> </personTwo></createHelloPerson></soap:Body></soap:Envelope>
> 
> Can any Body tell me whether I am using the proper soap message or not?As
> I am getting the following 
> exception 
> 
>  [     RequestHandler.java:314:
> ERROR] Request SOAPService caused an error with the following message:
> Error calling
> event: org.ofbiz.webapp.event.EventHandlerException:
> org.xml.sax.SAXException (org.xm
> l.sax.SAXException)
> 
> thx in advance 
> SiddharthaC
> 
> 
> 
> 
> 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-tp9180865p18030955.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: Using SOAP complex types with OfBiz

Posted by Jacques Le Roux <ja...@les7arts.com>.
http://docs.ofbiz.org/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo#FAQ-Tips-Tricks-Cookbook-HowTo-Soap

Jacques

From: "siddhartha" <si...@yahoo.com>
> 
> Hello All ,
> 
> I tried the same with ofbiz R 607122 . I first created the wsdl using
> Java2WSDL . Then I tried 
> to access the deployed webservice :
> 
> My service def looks like the following :
> 
> <service name="createHelloPerson" engine="java"
>   location="org.ofbiz.hello3.Hello3Services" invoke="createHelloPerson"
> export="true">
>        <description>Create a HelloPerson</description> 
>   <namespace>http://home.com</namespace>        
> <attribute name="personTwo" mode="IN" type="org.ofbiz.hello3.ComplexTest"
> optional="true"/>     </service>
> 
> my SoapMessage :
> 
> <soap:Body>
> <createHelloPerson>
> <personTwo xsi:type=\"xsd:complexType\">
> <name xsi:type=\"xsd:attribute\">peters</name>
> </personTwo></createHelloPerson></soap:Body></soap:Envelope>
> 
> Can any Body tell me whether I am using the proper soap message or not?As I
> am getting the following 
> exception 
> 
> [     RequestHandler.java:314:
> ERROR] Request SOAPService caused an error with the following message: Error
> calling
> event: org.ofbiz.webapp.event.EventHandlerException:
> org.xml.sax.SAXException (org.xm
> l.sax.SAXException)
> 
> thx in advance 
> SiddharthaC
> 
> 
> 
> 
> 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-tp9180865p17886201.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>