I'm using SSRS SDK for PHP
PHP Version 5.4
WebServer: Centos 6.4
MSSQL Server 2008 R2
When I make
$ssrs_report = new SSRSReport(new Credentials(UID, PASWD), SERVICE_URL);
I got the following error
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL:
Couldn't load from 'http://172.16.4.63/ReportServerURL/Pages/ReportViewer.aspx?%2fTestFolder%2ftestClaimHdr&rs:Command=Render/ReportExecution2005.asmx?wsdl' :
Premature end of data in tag html line 1 in /var/www/emilio/app/Libraries/SSRSReport/bin/SSRSReport.php:196
Stack trace: #0 /var/www/emilio/app/Libraries/SSRSReport/bin/SSRSReport.php(196):
SoapClient->SoapClient('http://172.16.4...', Array) #1 /var/www/emilio/SSRS/index.php(12):
SSRSReport->SSRSReport(Object(Credentials), 'http://172.16.4...') #2 {main} thrown in
/var/www/emilio/app/Libraries/SSRSReport/bin/SSRSReport.php on line 196
I'm looking how to fix it and get the report trough the soap(SSRS SDK for PHP).
I tried using file_get_content() and curl and both worked fine, then isn't connection problems, I have
Soap Client enabled
allow_url_fopen is On
this is the line where the sdk call the soap service
$executionServiceUrl="http://172.16.4.63/ReportServerURL?%2fTestFolder%2ftestClaimHdr&rs:Command=Render/ReportExecution2005.asmx?wsdl";
$options = array ( 'login' => 'xxxx\\xxxx', 'password' => 'xxxx', )
$this->_soapHandle_Exe = new SoapClient($executionServiceUrl, $options);
Adding
try {
$this->_soapHandle_Exe = new SoapClient($executionServiceUrl, $options);
} catch (Exception $e) {
var_export(libxml_get_last_error());
}
I get the following array:
LibXMLError::__set_state(array(
'level' => 3,
'code' => 77,
'column' => 43325,
'message' => 'Premature end of data in tag html line 1',
'file' => 'http://172.16.4.63/ReportServerURL?%2fTestFolder%2ftestClaimHdr&rs:Command=Render/ReportExecution2005.asmx?WSDL',
'line' => 1,
)
According to xmlerror from libxml2
level 3 = XML_ERR_FATAL = 3 : A fatal error
code 77 = XML_ERR_TAG_NOT_FINISHED = 77 : 77
I have alredy set the Basic authentication in the SSRS SERVER
Update
As #jwhaley58 said I changed to:
define("SERVICE_URL", "http://172.16.4.63/ReportServerURL");
$ssrs_report = new SSRSReport(new Credentials(UID, PASWD), SERVICE_URL);
$ssrs_report->LoadReport2('testClaimHdr',NULL);
and I get:
Fatal error: Uncaught exception 'SSRSReportException' in
/var/www/emilio/app/Libraries/SSRSReport/bin/SSRSReport.php:590 Stack trace: #0
/var/www/emilio/app/Libraries/SSRSReport/bin/SSRSReport.php(326):
SSRSReport->ThrowReportException(Object(SoapFault)) #1 /var/www/emilio/SSRS/index.php(15):
SSRSReport->LoadReport2('testClaimHdr', NULL) #2 {main} thrown in
/var/www/emilio/app/Libraries/SSRSReport/bin/SSRSReport.php on line 590
Some gochas that I only found through trial and error are some configuration issues, on the server that is running the reporting server service, make sure that in your file rsreportserver.config has been modified to allow for basic authentication. By default, if I'm understanding it correctly, it wants a more trustworthy connection type, but the sdk needs you to allow simple name and passwords to be passed. This means that needs to be added to your authentication methods in the configuration.
so for example,
In
C:\Program Files\Microsoft SQL Server\MSRS11.1\Reporting Services\ReportServer\rsreportserver.config (Different for server and version, but you get the idea.)
<Authentication>
<AuthenticationTypes>
<RSWindowsNTLM/>
<RSWindowsBasic/> ##you need to add this one##
</AuthenticationTypes>
<RSWindowsExtendedProtectionLevel>Off</RSWindowsExtendedProtectionLevel>
</Authentication>
IIRC you will have to restart the service for this to take effect.
Also, if you are attempting to RenderAs, some of the template files used to pop the headers have space in them towards the bottom that will prevent you from rendering as Excel, PDF, ect unless that has been fixed since I worked on it.
I'm looking through the code you provided, I may be reading it wrong, but it looks like you are trying to explicitly define the report you're after in the execution url. If that is in fact what you are doing, I believe the fix would be to only define the report base you are connecting to so for your example the url should be http://172.16.4.63/ReportServer/. After that connection is made, you would use the LoadReport2 function to specify which report you need.
Lastly, Where you have the name of the report, it looks like you have a subdirectory called testfolder? if that is still the case, you would need your report name to be "/TestFolder/testClaimHdr" in the call to LoadReport2.
Hope any of that helps.
Related
I'm trying to download order details from a woocommerce API for easy display and update purpose.
I tested the entire setup locally with two separate web addresses. One for test woocommerce install [copy from production site] and one for order display webpage.
Everything works fine locally. But when I connect the order display to production. It downloads all orders and display according to my design, But when I try to update an order it throws an exception.
After googling for a while found that this could be caused by timezone differences, checked time on both server and my pc it was spot on.
Anyway I changed
php timezone to correct one on both server and pc php.ini and restarted httpd
changed server linux timezone and rebooted the server.
Still, I get following only in production[hosted in AWS]. In no expert on php, but got some programming knowledge. Anyone who can point me to correct direction?
Fatal error: Uncaught exception
'Automattic\WooCommerce\HttpClient\HttpClientException' with message 'Error:
Invalid signature - provided signature does not match.
[woocommerce_rest_authentication_error]' in
C:\xampp\htdocs\orderdash\vendor\automattic\woocommerce\src\WooCommerce\HttpClient\HttpClient.php:348 Stack trace: #0
C:\xampp\htdocs\orderdash\vendor\automattic\woocommerce\src\WooCommerce\HttpClient\HttpClient.php(378): Automattic\WooCommerce\HttpClient\HttpClient->lookForErrors(Object(stdClass)) #1
C:\xampp\htdocs\orderdash\vendor\automattic\woocommerce\src\WooCommerce\HttpClient\HttpClient.php(414): Automattic\WooCommerce\HttpClient\HttpClient->processResponse() #2
C:\xampp\htdocs\orderdash\vendor\automattic\woocommerce\src\WooCommerce\Client.php(69): Automattic\WooCommerce\HttpClient\HttpClient->request('orders/544', 'PUT', Array) #3
C:\xampp\htdocs\orderdash\index.php(149): Automattic\WooCommerce\Client->put('orders/544', Array) #4 {main} thrown in
C:\xampp\htdocs\orderdash\vendor\automattic\woocommerce\src\WooCommerce\HttpClient\HttpClient.php on line 348
Connection
$woocommerce = new Client('http://example.com/',
'ck_321cad474478e1275',
'cs_76f8566e67cd7aa31',
['wp_api' => true, 'version' => 'wc/v1']);
Download orders
$data = ['status' => 'processing'];
$order_details = $woocommerce->get('orders',$data);
update data [use a button submit]
$update_order_id = $_POST['orderid'];
$st = ['status' => 'completed'];
$woocommerce->put('orders/'. $update_order_id, $st);
I'm trying to make a simple PHP web service that returns a simple message. I have enabled SOAP in php.ini. I'm getting the following error:
SoapFault exception:
[HTTP] Could not connect to host in D:\AppServ\www\projectName\SOAPWSTest\client.php:11
Stack trace:
#0 [internal function]: SoapClient->__doRequest('__soapCall('flag', Array)
#2 {main}string(494) " "
Line 11 corresponds to the __soapCall. __getLastRequest returns nothing. I tried setting soap_version to SOAP_1_2 or SOAP_1_1 to no avail. I have to set connection_timeout to 1 because if not, the browser takes forever to do a timeout and return the same message. I don't know what I'm doing wrong. Firewalls and whatnot are probably not a problem, as other parts of the project work perfectly.
One of my guesses would be that the namespace is wrong, but I haven't found a good and simple explanation of how the namespace works. Also, all simple web service examples I have tried implementing give me the same problem, which leads me to think this is some kind of configuration problem.
Codes are as follows:
Server:
<?php
function flag(){
return "<img src='http://usa.fmcdn.net/data/flags/w580/ga.png' alt='Georgia'>";
}
$server = new SoapServer(null, array('uri' => "http://localhost:81/projectName/SOAPWSTest/"));
$server->addFunction('flag');
$server->handle();
Client:
<?php
print "<h1>SOAP Client</h1>";
print "<h2>Echo Web Service</h2>";
$client = new SoapClient(null, array(
'connection_timeout' => 1,
'trace' => TRUE,
'exceptions' => FALSE,
'location' => "http://localhost:81/projectName/SOAPWSTest/server.php",
'uri' => "http://localhost:81/projectName/SOAPWSTest/"
));
print $client->__soapCall("flag", array(null));
print "</br></br>Last request:</br></br>" . var_dump($client->__getLastRequest());
I am trying to use PHP to connect to ServiceNow and retrieve incident records.
I tried to use the code below but somehow I receive errors:
<?php
$credentials = array('login'=>'user', 'password'=>'pass');
$client = new SoapClient("https://blah.com/incident.do?WSDL", $credentials);
$params = array('param1' => 'value1', 'param1' => 'value1');
$result = $client->__soapCall('getRecords', array('parameters' => $params));
// result array stored in $result->getRecordsResult
?>
I am always getting:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https : // blah . service-now . com / incident.do?WSDL' : failed to load external entity "https : // blah . service-now.com / incident.do?WSDL" in /var/www/index.php:3 Stack trace: #0 /var/www/index.php(3): SoapClient->SoapClient('https://blah.ser...', Array) #1 {main} thrown in /var/www/index.php on line 3
Of course I use the subdomain I want instead of blah. But let's assume it's blah.
Please help me. Is this code ok? Where do I place my username? On the user area? or in the login area? What about param1 and value1, which one of these do I need to change?
Yes, I have permission to do this on my servicenow instance, I can do other things regarding soap and wsdl.
goto "System Properties" -> "Web Services" and make sure that
"Require authorization for incoming WSDL requests." ist set to NO
If this flag is set to Yes you will not be able to directly create a SoapClient within PHP the way you described it.
I am trying to create a website that retrieves data from a Web Service using the site API.
The 'nuSOAP' PHP library seems to be a perfect way to go about this and so I have been trying to run through a basic tutorial by Scott Nichol called 'Introduction to NuSOAP'.
Here is the code for server.php:
<?php
// Pull in the NuSOAP code
require_once('nusoap.php');
// Create the server instance
$server = new soap_server;
// Register the method to expose
$server->register('hello');
// Define the method as a PHP function
function hello($name) {
return 'Hello, ' . $name;
}
// Use the request to (try to) invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>
...and here is the code for the client.php:
<?php
// Pull in the NuSOAP code
require_once('nusoap.php');
// Create the client instance
$client = new soapclient('http://localhost/beehive/server.php');
// Call the SOAP method
$result = $client->call('hello', array('name' => 'John'));
// Display the result
print_r($result);
?>
I have 'XAMMP' installed and so when I call up client.php via the browser it should bring up a basic page that says 'Hello, John' but instead I get the following error message:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from '.../server.php' : Start tag expected, '<' not found in C:\xampp\htdocs\beehive\client.php:7 Stack trace: #0 C:\xampp\htdocs\beehive\client.php(7): SoapClient->SoapClient('http://...') #1 >{main} thrown in C:\xampp\htdocs\beehive\client.php on line 7
I figured I should be loading the client page rather than the server, but if I load server.php then I get the error message 'This service does not provide a Web description'.
I have followed the tutorial exactly and can't figure out why it's throwing this error; can anyone please help?
Thank you!
The error you receive makes perfect sense with your error description. The server isn't responding with the right format and therefor your client breaks.
The same error is discussed here:
nusoap simple server
You need to point the client constructor to your wsdl file...
$client = new soapclient('http://localhost/beehive/server.php');
Hi i am trying to use soap to get results from amazon, and i havent tried this before so i was trying some sample code. The problem is i get an error.
the code is this:
<?php
#Use the NuSOAP php library
//require_once('lib/nusoap.php');
$params->AWSAccessKeyId = AMAZON_API_KEY;
$params->Request->SearchIndex = 'Books';
$params->Request->Keywords = 'php5';
$amazon = new SoapClient('http://webservices.amazon.com/AWSECommerceService /AWSECommerceService.wsdl');
$result = $amazon->itemSearch($params);
echo $result;
?>
and this is the error i get when i run it. thanx for your time
Fatal error: Uncaught SoapFault exception: [aws:Client.MissingParameter] The request must contain the parameter Signature. in C:\wamp\www\amasearch.php:11 Stack trace: #0 [internal function]: SoapClient->__call('itemSearch', Array) #1 C:\wamp\www\amasearch.php(11): SoapClient->itemSearch(Object(stdClass)) #2 {main} thrown in C:\wamp\www\amasearch.php on line 11
Weird. The WSDL doesn't have a signature parameter for any type. BUT, I found this in Amazon dev forums. Recommend you to check it out (also, if you develop using amazon services, keep that resource at hand
https://forums.aws.amazon.com/ann.jspa?annID=483
Looks like security gates for services are now taller and bigger, mate
EDIT: This question link to some example in C#. Maybe it can help you out Amazon (AWS) - The request must contain the parameter Signature
And this is an example in AWS forums with PHP https://forums.aws.amazon.com/message.jspa?messageID=149715