ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rajesh Mallah <mallah.raj...@gmail.com>
Subject Re: How to pass org.apache.ofbiz.entity.GenericValue using XMLRPC ?
Date Fri, 23 Mar 2018 18:47:29 GMT
Hi Jacques / List  ,

I face the very same problem with SOAP too , pls have a look if the SOAP
message is OK. Please suggest any edits to the SOAP message which i may
try.


<!-- start of soap -->

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://ofbiz.apache.org/service/" xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
    <soap:Body>
        <ns1:calculateProductPrice>
            <ns1:map-Map soapenc:arrayType="soapenc:Array[3]"
xsi:type="soapenc:Array">
                <ns1:map-Entry soapenc:arrayType="xsd:anyType[2]"
xsi:type="soapenc:Array">
                    <ns1:map-Key>
                        <ns1:std-String value="login.username" />
                    </ns1:map-Key>
                    <ns1:map-Value>
                        <ns1:std-String value="admin" />
                    </ns1:map-Value>
                </ns1:map-Entry>
                <ns1:map-Entry soapenc:arrayType="xsd:anyType[2]"
xsi:type="soapenc:Array">
                    <ns1:map-Key>
                        <ns1:std-String value="login.password" />
                    </ns1:map-Key>
                    <ns1:map-Value>
                        <ns1:std-String value="ofbiz" />
                    </ns1:map-Value>
                </ns1:map-Entry>
                <ns1:map-Entry soapenc:arrayType="xsd:anyType[2]"
xsi:type="soapenc:Array">
                    <ns1:map-Key>
                        <ns1:std-String value="product" />
                    </ns1:map-Key>
                    <ns1:map-Value>
                        <ns1:map-Map>
                            <ns1:map-Entry
soapenc:arrayType="xsd:anyType[2]" xsi:type="soapenc:Array">
                                <ns1:map-Key>
                                    <ns1:std-String value="productId" />
                                </ns1:map-Key>
                                <ns1:map-Value>
                                    <ns1:std-String value="PROD_SY87B9B8MY"
/>
                                </ns1:map-Value>
                            </ns1:map-Entry>
                        </ns1:map-Map>
                    </ns1:map-Value>
                </ns1:map-Entry>
            </ns1:map-Map>
        </ns1:calculateProductPrice>
    </soap:Body>
</soap:Envelope>

<!-- end of soap -->

2018-03-24 00:08:15,421 |http-nio-8443-exec-2
|ModelService                  |E| [ModelService.validate] :
{calculateProductPrice} : (IN) Required test error:
org.apache.ofbiz.service.ServiceValidationException: Type check failed for
field [calculateProductPrice.product]; expected type is
[org.apache.ofbiz.entity.GenericValue]; actual type is [java.util.HashMap]
2018-03-24 00:08:15,421 |http-nio-8443-exec-2
|ServiceDispatcher             |E| Incoming context (in runSync :
calculateProductPrice) does not match expected requirements
org.apache.ofbiz.service.ServiceValidationException: Type check failed for
field [calculateProductPrice.product]; expected type is
[org.apache.ofbiz.entity.GenericValue]; actual type is [java.util.HashMap]



regds
mallah.



On Fri, Mar 23, 2018 at 3:43 PM, Rajesh Mallah <mallah.rajesh@gmail.com>
wrote:

>
> 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 }   } );
>
> ========================================
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message