Hello Taher ,

As suggested i shifted this discussion to the user list from dev.

As you expected the product key has a value which is a
struct. This maps to java.util.HashMap but the validator
expects it to be a GenericValue and hence it does not hands it over
to the service.


$ ./007-get-price.pl  PROD_SY87B9B8MY
2018/03/23 15:34:31
--------------------------------------------------------------------------------
2018/03/23 15:34:31 REQ  >>>>>>>>>   <?xml version="1.0" encoding="UTF-8"?>
REQ  >>>>>>>>>   <methodCall>
REQ  >>>>>>>>>     <methodName>calculateProductPrice</methodName>
REQ  >>>>>>>>>     <params>
REQ  >>>>>>>>>       <param>
REQ  >>>>>>>>>         <value>
REQ  >>>>>>>>>          <struct>
REQ  >>>>>>>>>            <member>
REQ  >>>>>>>>>              <name>login.password</name>
REQ  >>>>>>>>>              <value>
REQ  >>>>>>>>>                <string><![CDATA[ofbiz]]></string>
REQ  >>>>>>>>>              </value>
REQ  >>>>>>>>>            </member>
REQ  >>>>>>>>>            <member>
REQ  >>>>>>>>>              <name>product</name>
REQ  >>>>>>>>>              <value>
REQ  >>>>>>>>>                <struct>
REQ  >>>>>>>>>                  <member>
REQ  >>>>>>>>>                    <name>productId</name>
REQ  >>>>>>>>>                    <value>
REQ  >>>>>>>>>
<string><![CDATA[PROD_SY87B9B8MY]]></string>
REQ  >>>>>>>>>                    </value>
REQ  >>>>>>>>>                  </member>
REQ  >>>>>>>>>                </struct>
REQ  >>>>>>>>>              </value>
REQ  >>>>>>>>>            </member>
REQ  >>>>>>>>>            <member>
REQ  >>>>>>>>>              <name>login.username</name>
REQ  >>>>>>>>>              <value>
REQ  >>>>>>>>>                <string><![CDATA[admin]]></string>
REQ  >>>>>>>>>              </value>
REQ  >>>>>>>>>            </member>
REQ  >>>>>>>>>          </struct>
REQ  >>>>>>>>>         </value>
REQ  >>>>>>>>>       </param>
REQ  >>>>>>>>>     </params>
REQ  >>>>>>>>>   </methodCall>
2018/03/23 15:34:31
--------------------------------------------------------------------------------
2018/03/23 15:34:31
--------------------------------------------------------------------------------
2018/03/23 15:34:31 RES  <<<<<<<<<   <?xml version="1.0" encoding="UTF-8"?>
RES  <<<<<<<<<   <methodResponse
RES  <<<<<<<<<     xmlns:ex="
http://ws.apache.org/xmlrpc/namespaces/extensions";>
RES  <<<<<<<<<     <fault>
RES  <<<<<<<<<       <value>
RES  <<<<<<<<<         <struct>
RES  <<<<<<<<<          <member>
RES  <<<<<<<<<            <name>faultCode</name>
RES  <<<<<<<<<            <value>
RES  <<<<<<<<<              <i4>0</i4>
RES  <<<<<<<<<            </value>
RES  <<<<<<<<<          </member>
RES  <<<<<<<<<          <member>
RES  <<<<<<<<<            <name>faultString</name>
RES  <<<<<<<<<            <value>Type check failed for field
RES  <<<<<<<<<              [calculateProductPrice.product]; expected type
is
RES  <<<<<<<<<              [org.apache.ofbiz.entity.GenericValue]; actual
type is
RES  <<<<<<<<<              [java.util.HashMap]</value>
RES  <<<<<<<<<          </member>
RES  <<<<<<<<<         </struct>
RES  <<<<<<<<<       </value>
RES  <<<<<<<<<     </fault>
RES  <<<<<<<<<   </methodResponse>
2018/03/23 15:34:31
--------------------------------------------------------------------------------
Service: calculateProductPrice faultString:Type check failed for field
[calculateProductPrice.product]; expected type is
[org.apache.ofbiz.entity.GenericValue]; actual type is [java.util.HashMap]

========================================
$ cat 007-get-price.pl

#!/usr/bin/perl

use OFBizClient;

my $ofbiz_client = OFBizClient->new(
                                url => '
https://your_ofbiz_server_here/webtools/control/xmlrpc' ,
                                username=>'admin'  ,
                                password => 'ofbiz'
);

my $productId = 'PROD_SY87B9B8MY';
$ofbiz_client->call('calculateProductPrice' , { product => { productId =>
$productId }   } );

========================================

Reply via email to