Thanks Paul, I tryed that syntax too, but apparently the one that works better
is the one I show, with the one you say it generates an exception on the client
side, just after sending.
From: Paul Foxworthy <[email protected]>
To: [email protected]; Alfonso Barreto <[email protected]>
Sent: Monday, February 27, 2017 6:51 PM
Subject: Re: Problem consuming ofbiz soap services from PHP
Hi Alfonso,
The log suggests to me that the parameters are not being *sent*: OFBiz is just
receiving an empty map:
<map-Map><map-Entry></map-Entry><map-Entry></map-Entry><map-Entry></map-Entry><map-Entry></map-Entry><map-Entry></map-Entry><map-Entry></map-Entry><map-Entry></map-Entry></map-Map>
A map entry has a key and a value. Try using the PHP syntax to create an
associative array:
array( key => value, key2 => value2, key3 => value3, ...);
You could try using something to see the exact SOAP message before OFBiz
processes it, perhaps SoapUI (soapui.org).
Hope that helps.
Paul Foxworthy
On 28 February 2017 at 10:52, Alfonso Barreto <[email protected]> wrote:
Been trying to find and updated reference for this, but still haven't found it.
I try to consume the soap testing services that comes on ofbiz, but for some
reason, the parameters are not readed on the server part. This is the code Iam
using on PHP, tryed several combinations but cant find the rigth one.
Will appreciate some help.
ini_set('soap. wsdl_cache_enabled', 0);
ini_set('soap.wsdl_cache_ttl', 900);
ini_set('default_socket_ timeout', 15);
//$wsdl = 'https://107.180.69.62/ webtools/control/SOAPService/
getProductInventoryAvailable? WSDL';
//$wsdl = 'https://107.180.69.62/ webtools/control/SOAPService/
testRemoteSoap?WSDL';
//$wsdl = 'https://107.180.69.62/ webtools/control/SOAPService/
testRemoteSoap1?WSDL';
//$wsdl = 'https://107.180.69.62/ webtools/control/SOAPService/
testSoapSimple?WSDL';
$wsdl = 'https://107.180.69.62/ webtools/control/SOAPService/
testSoap?WSDL';
$wsdl = 'https://107.180.69.62/ product/control/
soapGetProductNames/ soapWebService?WSDL';
$data=null;
$options = array(
//'style'=>SOAP_RPC,
//'use'=>SOAP_ENCODED,
'soap_version'=>SOAP_1_2,
//'cache_wsdl'=>WSDL_CACHE_ NONE,
'connection_timeout'=>15,
'trace'=>true,
'encoding'=>'UTF-8',
'exceptions'=>true,
);
try {
$soap = new SoapClient($wsdl,$options);
//$soap->__soapCall('lupe',' lupe','lupe1234','es',null,
testSoapSimple', array($params));
//$data = $soap->testSoapSimple(array('
lupe','lupe','lupe1234','es', null,34.5,'testPrueba')); //$params);
//$data = $soap->testSoap(array('lupe','
lupe','lupe1234','es',null,34. 5,'testPrueba'));
//$data = $soap->testRemoteSoap(array(
34.6,'Prueba2Test','lupe',' lupe1234'));
//$data = $soap->testRemoteSoap1(array('
56789','LatLonListZipCode'));
$data = $soap->soapWebService(array(' prueba'));
}
catch(Exception $e) {
print $e->getMessage();
}
var_dump($data);
In any combination I use, this is the log I get on the server:
2017-02-27 17:49:38,757 (http-0.0.0.0-443-10) [
VisitHandler.java:233:INFO ] Found visitorId [null] in cookie
2017-02-27 17:49:38,840 (http-0.0.0.0-443-10) [
RequestHandler.java:282:INFO ] This is the first request in this visit.
sessionId= A41F2EF98F6C29894283AB3FAE4F73 9B.jvm1
2017-02-27 17:49:38,841 (http-0.0.0.0-443-10) [
RequestHandler.java:641:INFO ] Ran Event [java:org.ofbiz.webapp.
control.LoginWorker# check509CertLogin] from [preprocessor], result is [success]
2017-02-27 17:49:38,842 (http-0.0.0.0-443-10) [
RequestHandler.java:641:INFO ] Ran Event [java:org.ofbiz.webapp.
control.LoginWorker# checkRequestHeaderLogin] from [preprocessor], result is
[success]
2017-02-27 17:49:38,842 (http-0.0.0.0-443-10) [
RequestHandler.java:641:INFO ] Ran Event [java:org.ofbiz.webapp.
control.LoginWorker# checkServletRequestRemoteUserL ogin] from [preprocessor],
result is [success]
2017-02-27 17:49:38,843 (http-0.0.0.0-443-10) [
RequestHandler.java:641:INFO ] Ran Event [java:org.ofbiz.webapp.
control.LoginWorker# checkExternalLoginKey] from [preprocessor], result is
[success]
2017-02-27 17:49:38,844 (http-0.0.0.0-443-10) [
RequestHandler.java:641:INFO ] Ran Event [java:org.ofbiz.webapp.
control.ProtectViewWorker# checkProtectedView] from [preprocessor], result is
[success]
2017-02-27 17:49:38,880 (http-0.0.0.0-443-10) [
SOAPEventHandler.java:160:INFO ] Request Message:
<?xml version="1.0" encoding="utf-8"?><env: Envelope
xmlns:env="http://www.w3.org/ 2003/05/soap-envelope" xmlns:ns1="http://ofbiz.
apache.org/service/"><env: Body><ns1:testSoap><map-Map><
map-Entry></map-Entry><map- Entry></map-Entry><map-Entry><
/map-Entry><map-Entry></map- Entry><map-Entry></map-Entry><
map-Entry></map-Entry><map- Entry></map-Entry></map-Map></
ns1:testSoap></env:Body></env: Envelope>
2017-02-27 17:49:38,897 (http-0.0.0.0-443-10) [
SOAPEventHandler.java:261:INFO ] Response Message:
<?xml version="1.0" encoding="utf-8"?><soapenv: Envelope
xmlns:soapenv="http://schemas. xmlsoap.org/soap/envelope/"><
soapenv:Body><Response><map- Map>
<map-Entry>
<map-Key>
<std-String value="errorMessage"></std- String>
</map-Key>
<map-Value>
<null></null>
</map-Value>
</map-Entry>
</map-Map></Response></ soapenv:Body></soapenv: Envelope>
2017-02-27 17:49:38,899 (http-0.0.0.0-443-10) [
RequestHandler.java:421:ERROR] Request SOAPService caused an error with the
following message: Error calling event: org.ofbiz.webapp.event.
EventHandlerException
2017-02-27 17:49:38,900 (http-0.0.0.0-443-10) [
ServerHitBin.java:628:INFO ] Visit delegatorName=default, ServerHitBin
delegatorName=default
2017-02-27 17:49:38,934 (http-0.0.0.0-443-10) [
ServerHitBin.java:722:INFO ] Duplicate ServerHit was updated:
[GenericEntity:ServerHit][ contentId,webtools. SOAPService(java.lang.String)]
[createdStamp,2017-02-27 17:49:38.903(java.sql. Timestamp)][createdTxStamp,
2017-02-27 17:49:38.9(java.sql.Timestamp) ][hitStartDateTime,2017-02-27
17:49:38.756(java.sql. Timestamp)][hitTypeId,REQUEST( java.lang.String)][
lastUpdatedStamp,2017-02-27 17:49:38.903(java.sql. Timestamp)][
lastUpdatedTxStamp,2017-02-27 17:49:38.9(java.sql.Timestamp)
][referrerUrl,(java.lang. String)][requestUrl,https:// 107.180.69.62/webtools/
control/SOAPService(java.lang. String)][runningTimeMillis,
143(java.lang.Long)][ serverHostName,s107-180-69-62.
secureserver.net(java.lang. String)][serverIpAddress,107.
180.69.62(java.lang.String)][ visitId,11053(java.lang. String)]
2017-02-27 17:49:38,935 (http-0.0.0.0-443-10) [
ControlServlet.java:328:INFO ] [[[SOAPService] Request Done- total:0.177,since
last([SOAPService] Req...):0.177]]
2017-02-27 17:50:29,461 (http-0.0.0.0-443-10) [ControlEventListener.java:65
:INFO ] Creating session: C458AFF4A31D8B54E2F7E547FC4DF4 BA.jvm1
2017-02-27 17:50:29,462 (http-0.0.0.0-443-10) [
ContextFilter.java:202:INFO ] [Request]: /webtools/control/SOAPService/ testSoap
2017-02-27 17:50:29,464 (http-0.0.0.0-443-10) [
ControlServlet.java:145:INFO ] [[[SOAPService] Request Begun, encoding=[UTF-8]-
total:0.0,since last(Begin):0.0]]
2017-02-27 17:50:29,464 (http-0.0.0.0-443-10) [
VisitHandler.java:233:INFO ] Found visitorId [null] in cookie
2017-02-27 17:50:29,599 (http-0.0.0.0-443-10) [
ConfigXMLReader.java:184:INFO ] controller loaded: 0.0s, 23 requests, 16 views
in file:/mnt/opentaps-1.5.0/ framework/common/webcommon/
WEB-INF/common-controller.xml
2017-02-27 17:50:29,602 (http-0.0.0.0-443-10) [
ConfigXMLReader.java:184:INFO ] controller loaded: 0.0s, 5 requests, 0 views in
file:/mnt/opentaps-1.5.0/ framework/common/webcommon/
WEB-INF/tempexpr-controller. xml
2017-02-27 17:50:29,605 (http-0.0.0.0-443-10) [
ConfigXMLReader.java:184:INFO ] controller loaded: 0.0s, 8 requests, 2 views in
file:/mnt/opentaps-1.5.0/ framework/testtools/webapp/
testtools/WEB-INF/controller. xml
2017-02-27 17:50:29,606 (http-0.0.0.0-443-10) [
ConfigXMLReader.java:184:INFO ] controller loaded: 0.01s, 110 requests, 64
views in file:/mnt/opentaps-1.5.0/ framework/webtools/webapp/
webtools/WEB-INF/controller. xml
2017-02-27 17:50:29,606 (http-0.0.0.0-443-10) [
RequestHandler.java:282:INFO ] This is the first request in this visit.
sessionId= C458AFF4A31D8B54E2F7E547FC4DF4 BA.jvm1
2017-02-27 17:50:29,607 (http-0.0.0.0-443-10) [
RequestHandler.java:641:INFO ] Ran Event [java:org.ofbiz.webapp.
control.LoginWorker# check509CertLogin] from [preprocessor], result is [success]
2017-02-27 17:50:29,608 (http-0.0.0.0-443-10) [
RequestHandler.java:641:INFO ] Ran Event [java:org.ofbiz.webapp.
control.LoginWorker# checkRequestHeaderLogin] from [preprocessor], result is
[success]
2017-02-27 17:50:29,608 (http-0.0.0.0-443-10) [
RequestHandler.java:641:INFO ] Ran Event [java:org.ofbiz.webapp.
control.LoginWorker# checkServletRequestRemoteUserL ogin] from [preprocessor],
result is [success]
2017-02-27 17:50:29,609 (http-0.0.0.0-443-10) [
RequestHandler.java:641:INFO ] Ran Event [java:org.ofbiz.webapp.
control.LoginWorker# checkExternalLoginKey] from [preprocessor], result is
[success]
2017-02-27 17:50:29,610 (http-0.0.0.0-443-10) [
RequestHandler.java:641:INFO ] Ran Event [java:org.ofbiz.webapp.
control.ProtectViewWorker# checkProtectedView] from [preprocessor], result is
[success]
2017-02-27 17:50:29,623 (http-0.0.0.0-443-10) [
RequestHandler.java:641:INFO ] Ran Event [soap:#] from [request], result is
[null]
2017-02-27 17:50:29,624 (http-0.0.0.0-443-10) [
ServerHitBin.java:628:INFO ] Visit delegatorName=default, ServerHitBin
delegatorName=default
2017-02-27 17:50:29,658 (http-0.0.0.0-443-10) [
ServerHitBin.java:722:INFO ] Duplicate ServerHit was updated:
[GenericEntity:ServerHit][ contentId,webtools. SOAPService(java.lang.String)]
[createdStamp,2017-02-27 17:50:29.628(java.sql. Timestamp)][createdTxStamp,
2017-02-27 17:50:29.625(java.sql. Timestamp)][hitStartDateTime, 2017-02-27
17:50:29.464(java.sql. Timestamp)][hitTypeId,REQUEST( java.lang.String)][
lastUpdatedStamp,2017-02-27 17:50:29.628(java.sql. Timestamp)][
lastUpdatedTxStamp,2017-02-27 17:50:29.625(java.sql.
Timestamp)][referrerUrl,(java. lang.String)][requestUrl,https
://107.180.69.62/webtools/ control/SOAPService/testSoap?
WSDL(java.lang.String)][ runningTimeMillis,160(java.
lang.Long)][serverHostName, s107-180-69-62.secureserver.
net(java.lang.String)][ serverIpAddress,107.180.69.62(
java.lang.String)][visitId, 11054(java.lang.String)]
2017-02-27 17:50:29,658 (http-0.0.0.0-443-10) [
ControlServlet.java:328:INFO ] [[[SOAPService] Request Done- total:0.194,since
last([SOAPService] Req...):0.194]]
2017-02-27 17:50:31,362 (http-0.0.0.0-443-10) [ControlEventListener.java:65
:INFO ] Creating session: D5C0BEB00515DC3D18C765C9D85D18 34.jvm1
2017-02-27 17:50:31,362 (http-0.0.0.0-443-10) [
ContextFilter.java:202:INFO ] [Request]: /webtools/control/SOAPService
2017-02-27 17:50:31,364 (http-0.0.0.0-443-10) [
ControlServlet.java:145:INFO ] [[[SOAPService] Request Begun, encoding=[utf-8]-
total:0.0,since last(Begin):0.0]]
2017-02-27 17:50:31,365 (http-0.0.0.0-443-10) [
VisitHandler.java:233:INFO ] Found visitorId [null] in cookie
2017-02-27 17:50:31,458 (http-0.0.0.0-443-10) [
RequestHandler.java:282:INFO ] This is the first request in this visit.
sessionId= D5C0BEB00515DC3D18C765C9D85D18 34.jvm1
2017-02-27 17:50:31,459 (http-0.0.0.0-443-10) [
RequestHandler.java:641:INFO ] Ran Event [java:org.ofbiz.webapp.
control.LoginWorker# check509CertLogin] from [preprocessor], result is [success]
2017-02-27 17:50:31,460 (http-0.0.0.0-443-10) [
RequestHandler.java:641:INFO ] Ran Event [java:org.ofbiz.webapp.
control.LoginWorker# checkRequestHeaderLogin] from [preprocessor], result is
[success]
2017-02-27 17:50:31,461 (http-0.0.0.0-443-10) [
RequestHandler.java:641:INFO ] Ran Event [java:org.ofbiz.webapp.
control.LoginWorker# checkServletRequestRemoteUserL ogin] from [preprocessor],
result is [success]
2017-02-27 17:50:31,461 (http-0.0.0.0-443-10) [
RequestHandler.java:641:INFO ] Ran Event [java:org.ofbiz.webapp.
control.LoginWorker# checkExternalLoginKey] from [preprocessor], result is
[success]
2017-02-27 17:50:31,462 (http-0.0.0.0-443-10) [
RequestHandler.java:641:INFO ] Ran Event [java:org.ofbiz.webapp.
control.ProtectViewWorker# checkProtectedView] from [preprocessor], result is
[success]
2017-02-27 17:50:31,473 (http-0.0.0.0-443-10) [
SOAPEventHandler.java:160:INFO ] Request Message:
<?xml version="1.0" encoding="utf-8"?><env: Envelope
xmlns:env="http://www.w3.org/ 2003/05/soap-envelope" xmlns:ns1="http://ofbiz.
apache.org/service/"><env: Body><ns1:testSoap><map-Map><
map-Entry></map-Entry><map- Entry></map-Entry><map-Entry><
/map-Entry><map-Entry></map- Entry><map-Entry></map-Entry><
map-Entry></map-Entry><map- Entry></map-Entry></map-Map></
ns1:testSoap></env:Body></env: Envelope>
2017-02-27 17:50:31,486 (http-0.0.0.0-443-10) [
SOAPEventHandler.java:261:INFO ] Response Message:
<?xml version="1.0" encoding="utf-8"?><soapenv: Envelope
xmlns:soapenv="http://schemas. xmlsoap.org/soap/envelope/"><
soapenv:Body><Response><map- Map>
<map-Entry>
<map-Key>
<std-String value="errorMessage"></std- String>
</map-Key>
<map-Value>
<null></null>
</map-Value>
</map-Entry>
</map-Map></Response></ soapenv:Body></soapenv: Envelope>
2017-02-27 17:50:31,488 (http-0.0.0.0-443-10) [
RequestHandler.java:421:ERROR] Request SOAPService caused an error with the
following message: Error calling event: org.ofbiz.webapp.event.
EventHandlerException
2017-02-27 17:50:31,488 (http-0.0.0.0-443-10) [
ServerHitBin.java:628:INFO ] Visit delegatorName=default, ServerHitBin
delegatorName=default
2017-02-27 17:50:31,530 (http-0.0.0.0-443-10) [
ServerHitBin.java:722:INFO ] Duplicate ServerHit was updated:
[GenericEntity:ServerHit][ contentId,webtools. SOAPService(java.lang.String)]
[createdStamp,2017-02-27 17:50:31.492(java.sql. Timestamp)][createdTxStamp,
2017-02-27 17:50:31.489(java.sql. Timestamp)][hitStartDateTime, 2017-02-27
17:50:31.364(java.sql. Timestamp)][hitTypeId,REQUEST( java.lang.String)][
lastUpdatedStamp,2017-02-27 17:50:31.492(java.sql. Timestamp)][
lastUpdatedTxStamp,2017-02-27 17:50:31.489(java.sql.
Timestamp)][referrerUrl,(java. lang.String)][requestUrl,https
://107.180.69.62/webtools/ control/SOAPService(java.lang.
String)][runningTimeMillis, 124(java.lang.Long)][
serverHostName,s107-180-69-62. secureserver.net(java.lang.
String)][serverIpAddress,107. 180.69.62(java.lang.String)][
visitId,11055(java.lang. String)]
2017-02-27 17:50:31,530 (http-0.0.0.0-443-10) [
ControlServlet.java:328:INFO ] [[[SOAPService] Request Done- total:0.166,since
last([SOAPService] Req...):0.166]]
--
Coherent Software Australia Pty Ltd
PO Box 2773
Cheltenham Vic 3192Australia
Phone: +61 3 9585 6788
Web: http://www.coherentsoftware.com.au/
Email: [email protected]