Hi Deval,

I tried to create a .NET web service that returned a Dictionary, then to
consume it from another .NET application. When I tried to consume it, I got
the error message "The type ... is not supported because it implements
IDictionary". It seems Microsoft's XmlSerializer mandates custom
serialization and deserialization of Dictionary and Hashtable, which are the
.NET equivalents of Map. In other words, you can't use those types in a web
service. See discussions of the issue at
http://stackoverflow.com/questions/679050/how-to-return-generic-dictionary-in-a-webservice,
http://blogs.msdn.com/b/adam/archive/2010/09/10/how-to-serialize-a-dictionary-or-hashtable-in-c.aspx,
http://forums.asp.net/t/63683.aspx/1, http://forums.asp.net/t/1567938.aspx/1

You can regard this as a limitation or bug that has been addressed in WCF.

Here's an article from Stack Overflow where someone overcame a similar
problem by just doing an HTTP request for the URL, then parsing the XML
themselves.

http://stackoverflow.com/questions/1132536/consuming-apachesoapmap-complex-datatype-in-webservice-using-net

Alternatives I can think of:

- Go to WCF and do something like
http://www.request-response.com/blog/PermaLink,guid,ff5fab81-affb-4b2b-aa67-c80bdfc86cbd.aspx

- Do as Rajbir Saini suggested: write a new web service in Java that
packages the data you want in a more accessible format for .NET.

Cheers

Paul Foxworthy


devalpatel wrote
> 
> Hello Paul.
> 
> 
> 
> After CallUpdateInventory method call,  the mapEntryArray beocomes null.
> That means in ofBiz the mapEntryArray is processed and then after it
> becomes null in ofbiz.
> 
> 
> 
> so, after calling CallUpdateInventory  in .net, the value for
> mapEntryArray is null. In ofBiz, i debug the code and found that, the
> values set in mapEntryArray  from c# is retrieved successfully. And after
> proccessing, the ofbiz method returns the required paramaters . But, i did
> not come to know that, then after from where the map becomes null ???
> 
> 
> 
> Thanks in advance.
> 
> 
> 
> Regards,
> 
> Deval
> 
>   ----- Original Message ----- 
>   From: Paul Foxworthy [via OFBiz] 
>   To: devalpatel 
>   Sent: Thursday, May 10, 2012 3:55 AM
>   Subject: Re: how to use ofBiz service in .Net application?
> 
> 
>   Hi Deval, 
> 
>   OK. 
> 
>   A ref parameter is both an input and an output. 
> 
>   Is there anything in the mapEntryArray after you've called the
> CallupdateInventory method? 
> 
>   Cheers 
> 
>   Paul Foxworthy 
> 
> 
>     devalpatel wrote
>     Hi  Paul, 
> 
>     Thanks for your reply. 
> 
>     There is no WSDLException generated. 
> 
>     void CallsearchHelloPerson(ref map)  => Here,  the type of map
> parameter is Map (ofBiz  method 's return type Map). 
> 
>     I have converted it according to the java Map type : 
>     //c# code 
>     static mapEntry makeMap(String keyString, String valString) { 
> 
>         stdString mapKeyString = new stdString(); 
> 
>         stdString mapValString = new stdString(); 
> 
>         mapKeyString.value = keyString; 
> 
>         mapValString.value = valString; 
> 
>         mapKey key = new mapKey(); 
> 
>         key.stdString = mapKeyString; 
> 
>         mapValue val = new mapValue(); 
> 
>         val.Item = mapValString; 
> 
>         val.ItemElementName = ItemChoiceType.stdString; 
> 
>         mapEntry entry = new mapEntry(); 
> 
>         entry.mapKey = key; 
> 
>         entry.mapValue = val; 
> 
>         return entry; 
> 
>       } 
> 
> 
>     //c# code for calling ofBiz service CallupdateInventory. 
> 
>     mapEntry[] mapEntryArray = new mapEntry[5]; 
> 
>     mapEntryArray[0] = makeMap("productId", ofbizProductid); 
> 
>     mapEntryArray[1] = makeMap("quantity", ofbizQOH); 
> 
>     mapEntryArray[2] = makeMap("status", "Paid"); 
> 
>     mapEntryArray[3] = makeMap("login.username", "admin"); 
> 
>     mapEntryArray[4] = makeMap("login.password", "ofbiz"); 
> 
>     ofBizInventory.CallupdateInventory(ref mapEntryArray); 
> 
>     So, the input paramter map passed to ofbiz service is received
> successfully at ofBiz side with all key values set from c# as shown ablve. 
> 
>     But, as you know the return of all methods in ofBiz is map so ofBiz
> returns map as result of "CallupdateInventory" api call. 
> 
>     In C#, the return type of CallupdateInventory API is void. That also
> mystery for me that why the generated client stub classes in c# are having
> return type void?? And, the actual method name in ofBiz is
> updateInventory(), but in the generated classes of c# there isn't
> updateInventory method & its CallupdateInventory(). 
> 
>     Hope, the above details provides more clarity of the problem. 
> 
>     Thanks, 
> 
>     Deval 
> 
>       ----- Original Message ----- 
>       From: Paul Foxworthy [via OFBiz] 
>       To: devalpatel 
>       Sent: Wednesday, May 09, 2012 4:45 AM 
>       Subject: Re: how to use ofBiz service in .Net application? 
> 
> 
>       Hi Deval, 
> 
>       Some of the nulls may not be a problem, if a method takes no
> parameters or returns void. 
> 
>       What's the message from the WSDLException? 
> 
>       Also, I noticed you mentioned earlier that your proxy in C# has 
> 
>       void CallsearchHelloPerson(ref map) 
> 
>       What's the type of the map parameter? Is there any value in it after
> you call OFBiz? 
> 
>       Cheers 
> 
>       Paul Foxworthy 
> 
> 
>         devalpatel wrote 
>         Hi Paul, 
>        
> http://localhost:8080/webtools/control/SOAPService/searchHelloPerson?wsdl
>         while generating the wsdl by hitting above URL in browser,,, i
> have debug the code in public void getWSDL(Definition def, String
> locationURI) throws WSDLException{} method. 
>         *****DEBUG RESULT (i have make BOLD to the null values in below
> result..) 
>        
> ________________________________________________________________________________________
>  
>         (com.ibm.wsdl.DefinitionImpl) Definition: name=null
> targetNamespace=http://ofbiz.apache.org/service/
>         Types: 
>         Message:
> name={http://ofbiz.apache.org/service/}searchHelloPersonRequest 
>         Part: name=map-Map 
>         typeName={http://ofbiz.apache.org/service/}map-Map 
>         Message:
> name={http://ofbiz.apache.org/service/}searchHelloPersonResponse 
>         Part: name=map-Map 
>         typeName={http://ofbiz.apache.org/service/}map-Map 
>         PortType:
> name={http://ofbiz.apache.org/service/}searchHelloPersonPortType 
>         Operation: name=searchHelloPerson 
>         Input: name=null 
>         Message:
> name={http://ofbiz.apache.org/service/}searchHelloPersonRequest 
>         Part: name=map-Map 
>         typeName={http://ofbiz.apache.org/service/}map-Map 
>         Output: name=null 
>         Message:
> name={http://ofbiz.apache.org/service/}searchHelloPersonResponse 
>         Part: name=map-Map 
>         typeName={http://ofbiz.apache.org/service/}map-Map 
>         Binding:
> name={http://ofbiz.apache.org/service/}searchHelloPersonSoapBinding 
>         PortType:
> name={http://ofbiz.apache.org/service/}searchHelloPersonPortType 
>         Operation: name=searchHelloPerson 
>         Input: name=null 
>         Message:
> name={http://ofbiz.apache.org/service/}searchHelloPersonRequest 
>         Part: name=map-Map 
>         typeName={http://ofbiz.apache.org/service/}map-Map 
>         Output: name=null 
>         Message:
> name={http://ofbiz.apache.org/service/}searchHelloPersonResponse 
>         Part: name=map-Map 
>         typeName={http://ofbiz.apache.org/service/}map-Map 
>         BindingOperation: name=searchHelloPerson 
>         BindingInput: name=null 
>         SOAPBody ({http://schemas.xmlsoap.org/wsdl/soap/}body): 
>         required=null 
>         use=literal 
>         encodingStyles={http://schemas.xmlsoap.org/soap/encoding/} 
>         namespaceURI=http://ofbiz.apache.org/service/
>         BindingOutput: name=null 
>         SOAPBody ({http://schemas.xmlsoap.org/wsdl/soap/}body): 
>         required=null 
>         use=literal 
>         encodingStyles={http://schemas.xmlsoap.org/soap/encoding/} 
>         namespaceURI=http://ofbiz.apache.org/service/
>         SOAPOperation ({http://schemas.xmlsoap.org/wsdl/soap/}operation): 
>         required=null 
>         soapActionURI=http://localhost:8080/webtools/control/SOAPService
>         style=rpc 
>         SOAPBinding ({http://schemas.xmlsoap.org/wsdl/soap/}binding): 
>         required=null 
>         transportURI=http://schemas.xmlsoap.org/soap/http
>         style=rpc 
>        
> ________________________________________________________________________________________
>  
>           
>         The generated WSDL is as below : 
> 
> 
>         <wsdl:definitions
> targetNamespace="http://ofbiz.apache.org/service/";>
>         − 
>         <wsdl:types>
>         − 
>         <xsd:schema targetNamespace="http://ofbiz.apache.org/service/";>
>         − 
>         <xsd:element name="std-String">
>         − 
>         <xsd:complexType>
>         <xsd:attribute name="value" type="xsd:string" use="required"/>
>         </xsd:complexType>
>         </xsd:element>
>         − 
>         <xsd:element name="std-Integer">
>         − 
>         <xsd:complexType>
>         <xsd:attribute name="value" type="xsd:integer" use="required"/>
>         </xsd:complexType>
>         </xsd:element>
>         − 
>         <xsd:element name="std-Long">
>         − 
>         <xsd:complexType>
>         <xsd:attribute name="value" type="xsd:long" use="required"/>
>         </xsd:complexType>
>         </xsd:element>
>         − 
>         <xsd:element name="std-Float">
>         − 
>         <xsd:complexType>
>         <xsd:attribute name="value" type="xsd:float" use="required"/>
>         </xsd:complexType>
>         </xsd:element>
>         − 
>         <xsd:element name="std-Double">
>         − 
>         <xsd:complexType>
>         <xsd:attribute name="value" type="xsd:double" use="required"/>
>         </xsd:complexType>
>         </xsd:element>
>         − 
>         <xsd:element name="std-Boolean">
>         − 
>         <xsd:complexType>
>         <xsd:attribute name="value" type="xsd:boolean" use="required"/>
>         </xsd:complexType>
>         </xsd:element>
>         − 
>         <xsd:element name="std-Locale">
>         − 
>         <xsd:complexType>
>         <xsd:attribute name="value" type="xsd:string" use="required"/>
>         </xsd:complexType>
>         </xsd:element>
>         − 
>         <xsd:element name="sql-Timestamp">
>         − 
>         <xsd:complexType>
>         <xsd:attribute name="value" type="xsd:dateTime" use="required"/>
>         </xsd:complexType>
>         </xsd:element>
>         − 
>         <xsd:element name="sql-Date">
>         − 
>         <xsd:complexType>
>         <xsd:attribute name="value" type="xsd:date" use="required"/>
>         </xsd:complexType>
>         </xsd:element>
>         − 
>         <xsd:element name="sql-Time">
>         − 
>         <xsd:complexType>
>         <xsd:attribute name="value" type="xsd:time" use="required"/>
>         </xsd:complexType>
>         </xsd:element>
>         <xsd:element name="col-ArrayList" type="tns:col-Collection"/>
>         <xsd:element name="col-LinkedList" type="tns:col-Collection"/>
>         <xsd:element name="col-Stack" type="tns:col-Collection"/>
>         <xsd:element name="col-Vector" type="tns:col-Collection"/>
>         <xsd:element name="col-TreeSet" type="tns:col-Collection"/>
>         <xsd:element name="col-HashSet" type="tns:col-Collection"/>
>         <xsd:element name="col-Collection" type="tns:col-Collection"/>
>         <xsd:element name="map-TreeMap" type="tns:map-Map"/>
>         <xsd:element name="map-WeakHashMap" type="tns:map-Map"/>
>         <xsd:element name="map-Hashtable" type="tns:map-Map"/>
>         <xsd:element name="map-Properties" type="tns:map-Map"/>
>         <xsd:element name="map-HashMap" type="tns:map-Map"/>
>         <xsd:element name="map-Map" type="tns:map-Map"/>
>         <xsd:element name="map-Entry" type="tns:map-Entry"/>
>         <xsd:element name="map-Key" type="tns:map-Key"/>
>         <xsd:element name="map-Value" type="tns:map-Value"/>
>         − 
>         <xsd:element name="eepk-" type="tns:map-Map">
>         − 
>         <xsd:annotation>
>         − 
>         <xsd:documentation>
>         The name of element need to be appended with name of entity such
> as eepk-Product for Product entity. 
>         </xsd:documentation>
>         </xsd:annotation>
>         </xsd:element>
>         − 
>         <xsd:element name="eeval-" type="tns:map-Map">
>         − 
>         <xsd:annotation>
>         − 
>         <xsd:documentation>
>         The name of element need to be appended with name of entity such
> as eeval-Product for Product entity. 
>         </xsd:documentation>
>         </xsd:annotation>
>         </xsd:element>
>         − 
>         <xsd:element name="cus-obj">
>         − 
>         <xsd:annotation>
>         − 
>         <xsd:documentation>
>         Object content need to be in CDATA such as <cus-obj></cus-obj>
>         </xsd:documentation>
>         </xsd:annotation>
>         </xsd:element>
>         − 
>         <xsd:complexType name="map-Map">
>         − 
>         <xsd:sequence>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:map-Entry"/>
>         </xsd:sequence>
>         </xsd:complexType>
>         − 
>         <xsd:complexType name="map-Entry">
>         − 
>         <xsd:sequence>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:map-Key"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:map-Value"/>
>         </xsd:sequence>
>         </xsd:complexType>
>         − 
>         <xsd:complexType name="map-Key">
>         − 
>         <xsd:all>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:std-String"/>
>         </xsd:all>
>         </xsd:complexType>
>         − 
>         <xsd:complexType name="map-Value">
>         − 
>         <xsd:choice>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:std-String"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:std-Integer"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:std-Long"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:std-Float"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:std-Double"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:std-Boolean"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:std-Locale"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:sql-Timestamp"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:sql-Date"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:sql-Time"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:col-ArrayList"/>
>         <xsd:element maxOccurs="1" minOccurs="1"
> ref="tns:col-LinkedList"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:col-Stack"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:col-Vector"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:col-TreeSet"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:col-HashSet"/>
>         <xsd:element maxOccurs="1" minOccurs="1"
> ref="tns:col-Collection"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:map-HashMap"/>
>         <xsd:element maxOccurs="1" minOccurs="1"
> ref="tns:map-Properties"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:map-Hashtable"/>
>         <xsd:element maxOccurs="1" minOccurs="1"
> ref="tns:map-WeakHashMap"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:map-TreeMap"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:map-Map"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:eepk-"/>
>         <xsd:element maxOccurs="1" minOccurs="1" ref="tns:eeval-"/>
>         </xsd:choice>
>         </xsd:complexType>
>         − 
>         <xsd:complexType name="col-Collection">
>         − 
>         <xsd:choice>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:std-String"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:std-Integer"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:std-Long"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:std-Float"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:std-Double"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:std-Boolean"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:std-Locale"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:sql-Timestamp"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:sql-Date"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:sql-Time"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:col-ArrayList"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:col-LinkedList"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:col-Stack"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:col-Vector"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:col-TreeSet"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:col-HashSet"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:col-Collection"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:map-HashMap"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:map-Properties"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:map-Hashtable"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:map-WeakHashMap"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:map-TreeMap"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:map-Map"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0" ref="tns:eepk-"/>
>         <xsd:element maxOccurs="unbounded" minOccurs="0"
> ref="tns:eeval-"/>
>         </xsd:choice>
>         </xsd:complexType>
>         </xsd:schema>
>         </wsdl:types>
>         − 
>         <wsdl:message name="searchHelloPersonRequest">
>         − 
>         <wsdl:part name="map-Map" type="tns:map-Map">
>         − 
>         <wsdl:documentation>
>         <attribute java-class="String" name="helloPersonId"
> namespace="http://ofbiz.apache.org/service/"; optional="true"
> type="std-String"/>
>         <attribute java-class="java.lang.String" name="login.username"
> namespace="http://ofbiz.apache.org/service/"; optional="true"
> type="std-String"/>
>         <attribute java-class="java.lang.String" name="login.password"
> namespace="http://ofbiz.apache.org/service/"; optional="true"
> type="std-String"/>
>         </wsdl:documentation>
>         </wsdl:part>
>         </wsdl:message>
>         − 
>         <wsdl:message name="searchHelloPersonResponse">
>         − 
>         <wsdl:part name="map-Map" type="tns:map-Map">
>         − 
>         <wsdl:documentation>
>         <attribute java-class="Map" name="name"
> namespace="http://ofbiz.apache.org/service/"; optional="true"
> type="eeval-"/>
>         </wsdl:documentation>
>         </wsdl:part>
>         </wsdl:message>
>         − 
>         <wsdl:portType name="searchHelloPersonPortType">
>         − 
>         <wsdl:operation name="searchHelloPerson">
>         <wsdl:input message="tns:searchHelloPersonRequest"/>
>         <wsdl:output message="tns:searchHelloPersonResponse"/>
>         </wsdl:operation>
>         </wsdl:portType>
>         − 
>         <wsdl:binding name="searchHelloPersonSoapBinding"
> type="tns:searchHelloPersonPortType">
>         <soap:binding style="rpc"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>         − 
>         <wsdl:operation name="searchHelloPerson">
>         <soap:operation
> soapAction="http://localhost:8080/webtools/control/SOAPService";
> style="rpc"/>
>         − 
>         <wsdl:input>
>         <soap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
> namespace="http://ofbiz.apache.org/service/"; use="literal"/>
>         </wsdl:input>
>         − 
>         <wsdl:output>
>         <soap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
> namespace="http://ofbiz.apache.org/service/"; use="literal"/>
>         </wsdl:output>
>         </wsdl:operation>
>         </wsdl:binding>
>         − 
>         <wsdl:service name="searchHelloPerson">
>         − 
>         <wsdl:port binding="tns:searchHelloPersonSoapBinding"
> name="searchHelloPersonPort">
>         <soap:address
> location="http://localhost:8080/webtools/control/SOAPService"/>
>         </wsdl:port>
>         </wsdl:service>
>         </wsdl:definitions>
> 
>         So, is there any problem in WSDL generation or generated WSDL  or
> any changes reauired in ofbiz ModelService.java???? 
>       -- 
>       Coherent Software Australia Pty Ltd 
>       http://www.cohsoft.com.au/
> 
>       Bonsai ERP, the all-inclusive ERP system 
>       http://www.bonsaierp.com.au/
> 
> 
> 
> 
>    
> ------------------------------------------------------------------------------
>  
> 
>       If you reply to this email, your message will be added to the
> discussion below: 
>      
> http://ofbiz.135035.n4.nabble.com/Re-how-to-use-ofBiz-service-in-Net-application-tp4580144p4619013.html
>   
>       To unsubscribe from Re: how to use ofBiz service in .Net
> application?, click here. 
>       NAML 
>   -- 
>   Coherent Software Australia Pty Ltd 
>   http://www.cohsoft.com.au/
> 
>   Bonsai ERP, the all-inclusive ERP system 
>   http://www.bonsaierp.com.au/
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> 
>   If you reply to this email, your message will be added to the discussion
> below:
>  
> http://ofbiz.135035.n4.nabble.com/Re-how-to-use-ofBiz-service-in-Net-application-tp4580144p4621981.html
>  
>   To unsubscribe from Re: how to use ofBiz service in .Net application?,
> click here.
>   NAML
> 

-----
--
Coherent Software Australia Pty Ltd
http://www.cohsoft.com.au/

Bonsai ERP, the all-inclusive ERP system
http://www.bonsaierp.com.au/

--
View this message in context: 
http://ofbiz.135035.n4.nabble.com/Re-how-to-use-ofBiz-service-in-Net-application-tp4580144p4622701.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply via email to