Hi ,

just to confirm back that it was possible to use SOAP to pass
product entity via 'eeval-Product' tag in XML   . ( using perl SOAP::Lite).
and get back the price will rules applied by the engine.


Below is a working script that will help Perl /  PHP developers.
=======================================================
#!/usr/bin/perl
#
use SOAP::Lite +trace => [qw/ debug method fault /];
my $uri = "http://ofbiz.apache.org/service/";;
my $proxyUrl = "
https://your-ofbiz-backend-hostname.com/webtools/control/SOAPService";;

my $soap = SOAP::Lite
 ->ns($uri , "ns1") ->proxy($proxyUrl, timeout => 5 )->readable(true);

my %map = (
    'login.username' => 'admin' ,
    'login.password' => 'ofbiz' ,
    'currencyUomId'  => 'INR' ,
);
my $product_id;
$product_id = $ARGV[0]  ;
foreach my $key (keys %map) {
    my $value = $map{$key};
    push @soap_map,[
        SOAP::Data->name('ns1:map-Key')->value(
            \SOAP::Data->name('ns1:std-String')->attr({'value' => $key })
        ) ,
        SOAP::Data->name('ns1:map-Value')->value(
            \SOAP::Data->name('ns1:std-String')->attr({'value' => $value })
        ) ,
    ];
}
my $product_xml = qq{ <productId>$product_id</productId> };
    push @soap_map,[
        SOAP::Data->name('ns1:map-Key')->value(
            \SOAP::Data->name('ns1:std-String')->attr({'value' => "product"
})
        ) ,
        SOAP::Data->name('ns1:map-Value')->value(
            \SOAP::Data->name('ns1:eeval-Product')->value(
                 \SOAP::Data->type('xml' => $product_xml)
            )
        ) ,
    ];
my @params = map {  SOAP::Data->name('ns1:map-Entry')->value($_) }
@soap_map;
my $map = SOAP::Data->name('ns1:map-Map')->value( \@params);
my $som = $soap->call('calculateProductPrice', $map  );
die $som->faultstring if ($som->fault);
=======================================================


Regds
Rajesh.




On Sun, Jul 19, 2020 at 2:45 PM Rajesh Mallah <[email protected]>
wrote:

> Hi Jacques,
>
> I will try that and post back the results when i really do it.
> thankful to all the developers and volunteers for developing
> and furthering such an excellent product.
>
> Regds
> Rajesh.
>
> On Sun, Jul 19, 2020 at 2:04 PM Jacques Le Roux <
> [email protected]> wrote:
>
>> Actually this has been committed in trunk with
>> https://issues.apache.org/jira/browse/OFBIZ-11328
>>
>> https://github.com/apache/ofbiz-framework/commit/04791d5/
>>
>> So you may try it...
>>
>> Jacques
>> PS: see also last comment from Ean Schuessler at
>> https://issues.apache.org/jira/browse/OFBIZ-4274
>>
>> Le 19/07/2020 à 09:37, Jacques Le Roux a écrit :
>> > Ah, forgot the main point of my answer!
>> >
>> > **Girish Vasmatkar is currently implementing a REST version of services
>> export. It's near to be complete:
>> > https://github.com/girishvasmatkar/ofbiz-rest-impl
>> >
>> > I thought you could be interested
>> >
>> > Jacques
>> >
>> > Le 19/07/2020 à 09:18, Jacques Le Roux a écrit :
>> >> Hi Rajesh,
>> >>
>> >> You already asked this question:
>> https://markmail.org/message/dwako4nsu4h3zgmu. I then spoke about SOAP
>> >>
>> >> Here is why: https://markmail.org/message/scilivxk3m4sz723
>> >>
>> >> Thanks to Ankush Upadhyay :)
>> >>
>> >> Jacques
>> >>
>> >> Le 19/07/2020 à 05:50, Rajesh Mallah a écrit :
>> >>> Hi ,
>> >>>
>> >>> Many ofbiz services as documented under ofbiz web tools -> service
>> list ,
>> >>> utilize parameters of *type* which have no direct mapping to the
>> client
>> >>> side
>> >>> environment.
>> >>>
>> >>> we have been using xml/rpc to invoke various webservices in ofbiz in
>> our
>> >>> applications but when it comes of services that use GenericValue as
>> >>> param type we are not able to provide proper input value from the
>> calling
>> >>> system.
>> >>>
>> >>> Is there any solution to this ?
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> Service Name calculateProductPrice Engine Name java
>> >>> <
>> https://haatnowofbiz.redgrape.tech:443/webtools/control/ServiceList?constraint=engine_name@java
>> >
>> >>> Description Calculate a Product's Price from
>> >>> ProductPriceRules
>> >>> Invoke calculateProductPrice
>> >>> Exportable True (Show wsdl
>> >>> <
>> https://haatnowofbiz.redgrape.tech:443/webtools/control/ServiceList?sel_service_name=calculateProductPrice&show_wsdl=true
>> >
>> >>> ) Location org.apache.ofbiz.product.price.PriceServices
>> >>> <
>> https://haatnowofbiz.redgrape.tech:443/webtools/control/ServiceList?constraint=location@org.apache.ofbiz.product.price.PriceServices
>> >
>> >>> Definition Location file Default Entity Name NA
>> >>> <
>> https://haatnowofbiz.redgrape.tech:443/webtools/control/ServiceList?constraint=default_entity_name@NA
>> >
>> >>> Artifact Info Artifact Info
>> >>> <
>> https://haatnowofbiz.redgrape.tech:443/webtools/control/ArtifactInfo?name=calculateProductPrice&type=service
>> >
>> >>> Require
>> >>> new transaction False
>> >>>    Use transaction False
>> >>>    Max retries -1
>> >>>
>> >>> Parameter Name Description Optional Type Mode Is set internally Entity
>> >>> Name Field
>> >>> Name
>> >>> agreementId
>> >>> True String IN False
>> >>>
>> >>> amount
>> >>> True BigDecimal IN False
>> >>>
>> >>> autoUserLogin
>> >>> *True* *org.apache.ofbiz.entity.GenericValue* IN False
>> >>>
>> >>> checkIncludeVat
>> >>> True String IN False
>> >>>
>> >>> currencyUomId
>> >>> True String IN False
>> >>>
>> >>> currencyUomIdTo
>> >>> True String IN False
>> >>>
>> >>> customAttributes
>> >>> True Map IN False
>> >>>
>> >>> findAllQuantityPrices
>> >>> True String IN False
>> >>>
>> >>> locale
>> >>> True java.util.Locale INOUT True
>> >>>
>> >>> login.password
>> >>> True String IN True
>> >>>
>> >>> login.username
>> >>> True String IN True
>> >>>
>> >>> optimizeForLargeRuleSet
>> >>> True String IN False
>> >>>
>> >>> partyId
>> >>> True String IN False
>> >>>
>> >>> prodCatalogId
>> >>> True String IN False
>> >>>
>> >>> *product*
>> >>> *False* *org.apache.ofbiz.entity.GenericValue* IN False
>> >>>
>> >>> productPricePurposeId
>> >>> True String IN False
>> >>>
>> >>> productStoreGroupId
>> >>> True String IN False
>> >>>
>> >>> productStoreId
>> >>> True String IN False
>> >>>
>> >>> quantity
>> >>> True BigDecimal IN False
>> >>>
>> >>> surveyResponseId
>> >>> True String IN False
>> >>>
>> >>> termUomId
>> >>> True String IN False
>> >>>
>> >>> timeZone
>> >>> True java.util.TimeZone INOUT True
>> >>>
>> >>> userLogin
>> >>> True org.apache.ofbiz.entity.GenericValue INOUT True
>> >>>
>> >>> webSiteId
>> >>> True String IN False
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> regds
>> >>> rajesh.
>> >>
>>
>

Reply via email to