php,soap,apache2,soap-clientRelated issues-Collection of common programming errors
hippietrail
php eol
When is it a good idea to use PHP_EOL? I sometimes see this in code samples of PHP. Does this handle DOS/Mac/Unix endline issues? Most of the PHP I write is for generating HTML, and I use <br/> instead of actual newlines, so haven’t used this constant before.
Steve
php html
I have strange problem. I am showing these links to interact with them via jQuery and at the very end it always puts symbol “1” for some reason. I’ve looked through all my pages and this was the one that caused it. Can you please explain why and how can I avoid that? It does not matter what I select from cat, 0 or any other viable id… P.S. I know that code is not complete, but this is just draft to make it all work together…<?php$sql = “SELECT * FROM cat WHERE catSubID = 0”;$result = mysq
the_void
php wordpress shortcode
I just found out that both ‘echo’ and ‘return’ works fine for displaying content from a shortcode function. function foobar_shortcode($atts) {echo “Foo Bar”; //this works fine }function foobar_shortcode($atts) {return “Foo Bar”; //so does this }I just want to know, is there any difference between using either of these? If so what’s the recommended one? I normally use echo in this case; is it okay?
user2315306
php button delete
I manage to succesfully read and display data from my database with the following code: http://pastebin.com/rjZfBWZX I also generate a delete button for each row of the table 🙂 Clicking the delete button calls “obrisi.php” which is supposed to delete that row but i messed something up :S Here’s obrisi.php code: http://pastebin.com/mrFy1i7SIm getting a Parse error: syntax error, unexpected ‘FROM’ (T_STRING) :S
OMG Ponies
php mysql
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING is the message. It came up from this line of code:$query = (“SELECT * FROM users WHERE user_name = $_POST[‘user_name’] & password = $_POST[‘password’] & user_type = $_POST[‘user_type’]”);Does anyone out there know the meaning of all this? If so, does anyone know how to deal with this?
hakre
php pcntl
Can anybody tell me why using the pcntl lib on production servers is discouraged? The PHP manual tells very briefly about it, and I’m in a dire need to use this library… Is there another way to do the same thing in php?
markus
php
In a legacy php script I found the following line of code:$CacheLite =& ( “string” );Which provokes an error:Parse error: syntax error, unexpected'(‘, expecting T_NEW or T_STRING orT_VARIABLE or ‘$’Is it a mistake or a way of passing by reference or something else I don’t know. Do I have to enable/disable something in my php configuration in order for this to work?
Ami
php
I’m using PHP 5.3.5 with Fast-CGI.When I try to use gmdate() to set the initial value for a parameter, I get the following error:Parse error: syntax error, unexpected ‘(‘, expecting ‘)’ inMyClass.php on line 3Here’s my code (line 3 is the line where myFunction is declared):function myFunction($myDate = gmdate(‘Y-m-d’)) {// … }Am I doing something wrong? Is this a bug? This also occurs if I do the same thing in a class function.
bee.catt
php function
$myVar=myFunction(array_reverse(explode(‘.’, $_SERVER[‘SERVER_NAME’])));Anything wrong with nesting functions like this?
F. Orvalho
php mysql
Is it possible to re-write the code below, maybe even with an if (result > 0) statement, in just one line (or simply shorter)?// a simple query that ALWAYS gets ONE table row as result $query = $this->db->query(“SELECT id FROM mytable WHERE this = that;”); $result = $query->fetch_object(); $id = $result->id;I’ve seen awesome, extremely reduced constructs like Ternary Operators (here and here – btw see the comments for even more reduced lines) putting 4-5 lines in one, so mayb
Rob Cooper
web-services soap wsdl
When coding web services, how do you structure your return values? How do you handle error conditions (expected ones and unexpected ones)? If you are returning something simple like an int, do you just return it, or embed it in a more complex object? Do all of the web methods within one service return an instance of a single class, or do you create a custom return value class for each method?
Marek Grzenkowicz
web-services rest soap soapui sugarcrm
I saw somewhere in net (like SugarCRM SOAP test call fails), that some people use SoapUI to access SugarCRM SOAP or REST web services, with urls like http://ip/sugarcrm/service/v2/soap.php and http://ip/sugarcrm/service/v2/rest.php, respectively. I tried it, with ‘New SoapUI Project’ wizard, and putting that urls in ‘Initial WSDL/WADL:”. But I only get error messages:”Error loading [http://ip/sugarcrm/service/v2/soap.php] org.apache.xmlbeans.XmlException: error: Unexpected character encountered:
Unknown User
php authentication soap nusoap wso2
I need to connect to a web service that requires authentication credentials in the form of a plain text user name and password.I have a basic understanding of SOAP and have managed to connect to other open web services that do not require a username or password using NuSOAP.The following was sent to me:<?php// Set up security options $security_options = array(“useUsernameToken” => TRUE); $policy = new WSPolicy(array(“security” => $security_options));$security_token = new WSSecurityToken
pankaj
iphone ios soap nsmutableurlrequest
I am trying to consume a SOAP web service from my iPhone application but I am getting following error when I check with Charles: Value cannot be null.
Parameter name: s Following is my code: NSString *soapMessage = [NSString stringWithFormat:@”<?xml version=\”1.0\” encoding=\”utf-8\”?><SOAP-ENV:Envelope xmlns:SOAP-ENV=\”http://schemas.xmlsoap.org/soap/envelope/\”><SOAP-ENV:Body><updateTimesheet><TimeSheetHourID>222</TimeSheetHourID></update
Gribbler
soap cxf wsdl2java
My application used CXF WSDL2JAVA to generate the Java classes from a client supplied WSDL.They’ve now changed their webservice to have 3 additional string fields in the response. It would be a bit of rework for us to regenerate the java classes, but we’re getting an exception:javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: unexpected element (newElement)Is there a way to get CXF to ignore the extra elements in the response?
deimos1988
android web-services soap wsdl ksoap2
I’m invoking a SOAP webservice using the ksoap2-library. I’m getting the error message “unexpected element” and would now like to see what is actually being sent.btw., HttpTransport.requestDump doesn’t work for some reason.Any help would be much appreciated!
zmonteca
php soap
If I run this$HostTransactionInfo = new HostTransactionInfo(); // std Object $HostTransactionInfo->SecurenetID = $cc->merchant->data[$this->name][‘secure_net_id’]; $HostTransactionInfo->SecureKey = $cc->merchant->data[$this->name][‘secure_key’]; $HostTransactionInfo->Test = self::TEST;$securenet = new SoapClient(self::WSDL, array(‘features’ => SOAP_SINGLE_ELEMENT_ARRAYS)); $host_trans_info = new SoapVar($HostTransactionInfo, SOAP_ENC_OBJECT); var_dump($host_trans_i
Chirayu
web-services soap wsdl salesforce apex
while make a webservice call out I am getting below error: Web service callout failed: Unexpected element. Parser was expecting element ‘http://schemas.xmlsoap.org/soap/envelope/:Envelope’ but found ‘:HTML’Please see below code which I am trying for this:public class TestUtility_Cls{public list<Test_webService.KeyValuePair> IOG_pair = new list<Test_webService.KeyValuePair>(); public pageReference calltestServices(){I_pair = new list<Test_webService.KeyValuePair>();Test_webServi
Saeed Lotfi
c# web-services soap wsdl
I am going to add EAN Hotel API into my Website or other Application. I add the SOAP WSDL Web Reference from : http://api.ean.com/ean-services/ws/hotel/v3?wsdl And now i want to get the hotel Info. I’m getting error : Unmarshalling Error: unexpected element (uri:”http://v3.hotel.wsapi.ean.com/”,local:”HotelListRequest”). Expected elements are <{}HotelListRequest>And my sample code is : var hotelService = new HotelServicesClient(“HotelServicesImplPort”);var hotelRequest = new HotelInformation
Cameron Smith
java json soap wsdl axis2
I have had a look at a lot of other StackOverflow questions to try and figure this out, but nothing that is specified seems to work. Any helpful suggestions would be very much appreciated.I had originally setup my own wsdl file, and generated the stubs on both the client and server side of the code using Axis2’s built in scripts. I then hooked the stubs into my GUI code on the client side, and my backend code on the other side. The code would begin to work, but then would give me a bunch of e
doelleri
php wordpress apache apache2
I have the following error message in the error log file of my website. Can you explain me what it means, is there security problem? How could I fix it?[Mon Feb 25 21:04:34 2013] [error] [client 173.199.116.83] PHP Parse error: syntax error, unexpected T_VARIABLE in /Mywebsite/wp-includes/functions.php on line 192[Mon Feb 25 20:48:01 2013] [error] [client 80.118.73.90] PHP Parse error: syntax error, unexpected T_VARIABLE in /Mywebsite/wp-includes/functions.php on line 192, referer: http://www.
rohith
java perl apache2 bugzilla
This is my java classimport java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; import java.util.Map;import org.apache.xmlrpc.XmlRpcException; import org.apache.xmlrpc.client.XmlRpcClient; import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; public class BugzillaAuthentication {public static void main(String[] args) throws MalformedURLException, XmlRpcException {XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();confi
SlovaN
regex mod-rewrite url-rewriting apache2
I’m playing with apache rewrite_mod (Apache/2.2.17 Win32) and encounter very weird behave of rewriteRule.My script primarily rewrite infinite filter parameters named f1 .. f<infinity> from nice url and in loop adding them as query variables, add path as query, and page number.It works flawlessly, but if I add one another rule (last rule in script)RewriteRule ^(.+)\.html$ /index.php?path=$1.html [QSA]which is for another cases, it change execution of rewriterule at s
Billy Bob Thornton
apache2 ubuntu compression images
I have a weird problem on my production web server running Apache on Ubuntu: it compresses my images thereby dramatically lowering their quality!Actually I have two virtual hosts running, each located in a different folder. Wether I display .gif images by navigating on the two sites, or acceding them directly by their url, their size and quality are invariably degraded. I tried with three different browsers: same problem. Using them on other sites on the Web: no problem. Of course I disabled mo
kalina
server apache2 php
I try to test my php installation on a ubuntu server without gui. Therefore I follow the 3rd this howto for LAMP(!). This includes to install php5 et al. withsudo apt-get install php5 libapache2-mod-php5 php5-mcryptThen PHP is added to the directory index.sudo nano /etc/apache2/mods-enabled/dir.confSo that the file is:<IfModule mod_dir.c>DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm </IfModule>I have the file /var/www/info.php like this:<?p
Private
12.04 apache2 rvm gem redmine
I have a running redmine version 1.3.2 on my ubuntu 12.04 already, and now i am trying to install a new 2.4.2 version at a different location.I used RVM to install ruby 1.9.2 and I need the passenger mod to run the application.I guess the to problem is in my passenger.conf location settings that’s what I found out.PassengerRoot /usrPassengerRuby /usr/share/ruby-rvm/rubies/ruby-1.9.2-p180/bin/rubyPassengerDefaultUser www-dataWith that configuration I receive an internal 500 error already from red
Kongthap
13.04 apache2 virtualhost
I would like to have 2 sites on my development machine.I edited /etc/hosts as follow127.0.0.1 restaurant.local www.restaurant.local 127.0.0.1 lrv4.local www.lrv4.localI created 2 new files /etc/apache2/sites-available/restaurant.local and ../lrv4.local<VirtualHost restaurant.local:80>ServerName restaurant.localServerAlias www.restaurant.localDocumentRoot /var/www/restaurant/public<Directory /var/www/restaurant/public/>Options FollowSymLinksAllowOverride None</Direc
jdpipe
10.04 server command-line ssh apache2
I have an Ubuntu 10.04 server that’s going a bit slow. It’s very slow to log in via SSH, and it’s very slow when making edits via a Mediawiki instance installed on there.For normal read access to the hosted website, it’s fast (I have APC installed, FWIW), and it’s also fast with SSH once I’m actually logged in.What sort of things should I be checking as possible sources of this problem? I need to diagnose it remotely.Cheers JP
Jacob Larson
apache2 php localhost
I have found a question very similar to this, which I thought would solve my problem. However, after changing my .htaccess file, with index.php on the end of the list, and then index.php as the only entry, I still cannot get index.php to display. Every other page works fine, but I don’t know how to fix this. Thanks.
César
installation apache2
Fresh new install of Ubuntu fresh new install of apache2. Apache not working, where should I start? It’s installed, it restarts properly it just doesn’t show anything in the browser but a 500 error:HTTP Error 500 (Internal Server Error): An unexpected condition wasencountered while the server was attempting to fulfill the request.
hakre
php paypal soap-client
$wsdl = “https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl”; $soap = new SoapClient($wsdl);throws the error:SOAP-ERROR: Parsing Schema: unexpected in sequenceTried on PHP versions 5.3.4, 5.3.0
hakre
php parsing wsdl soap-client
I have the following in a wsdl provdided by my service provider:<xsd:import namespace=”http://web-service-provider.com/2004/10/10″ schemaLocation=”ASchemas.xsd”/> <xsd:import namespace=”http://web-service-provider.com/2004/10/10″ schemaLocation=”BSchemas.xsd”/> <xsd:import namespace=”http://web-service-provider.com/2004/10/10″ schemaLocation=”CSchemas.xsd”/>and I get the following error when the SoapClient tries to parse the wsdl:SOAP-ERROR: Parsing Schema: unexpected <impor
hakre
php xml soap soap-client
So, I’m trying to work with SoapClient in php and I’m having an issue structuring my XML. I’m working with a soap API that’s expecting the following XML:<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:app=”http://app.whatever.com/”><soapenv:Header/><soapenv:Body><app:WhateverCleanseAddress><app:address><address Address1=”9100 Wilshire Blvd” Address2=”Ste 900″ Address3=”” City=”Beverly Hills” State=”CA” Zip=”90212″ Country=”US
Bruce McGee
delphi deployment soap-client
I built a Delphi-7 Windows Application which uses some web services. The application is built in such a way that it does not require run-time DLLs. When I deployed it on a Windows 2003 server it fails while calling the web service. It results in error “Access violation at address 00c05269. Write of address 00c05269”. I believe the reasons is that it needs some package to be installed. Can anybody help me to figure that out?TIA
DanJ
python wsdl soap-client suds
I’m trying to write a Python client for a a WSDL service. I’m using the Suds library to handle the soap messages. When I try to call the service, I get a suds exception: <rval /> not mapped to message part. If I set the retxml suds option I get XML which looks OK to me.Is the problem with the client code? Am I missing some flag which will allow Suds to correctly parse the XML? Alternatively, the problem could be with the server. Is the XML not structured correctly?Thanks, DanMy code is a f
Patrick
.net visual-c++ soap soap-client webservice-client
My application has its own scripting language of which I cannot get rid of (lots of customer-specific scripts written). Now my customers are asking if it would be possible to call a SOAP service from within that scripting language. Of course, the SOAP service that needs to be called will be different for every customer. This leaves me with several options:Use the WSDL utility to generate customer-specific SOAP client proxies and put the customer-specific logic in my application Use the WSDL u
hakre
php soap apache2 soap-client
Below I have included a stack trace of my PHP Client attempting to talk with the server. The client and server both read in the WSDL file file, so that part if of no concern.As you can see by the second stack trace array item, I’m passing in a two dimensional array, but when the SoapServer does it’s __doRequest() function, the array has been concatenated into a single, unmanageable string. Any solution on how to fix this would be greatly appreciated.Internal Server ErrorArray ( [0] => Array([
PKKG
php soap soap-client
Hello I’ve been trying the last days to do a request but it doesn’t work, I think it’s problem of the generated XML but I can’t get the last request, __getLastRequest() method returns a NULL value, this is my code:class AuthHeader{var $userName;var $password;var $authentication;var $locale;var $timeZone;public function __construct($param){$this->userName = $param[“userName”];$this->password = $param[“password”];if(isset($param[“authentication”])){$this->authentication = $param[“authenti
Cas Van Der Weegen
php xml soap wsdl soap-client
I’m currently working on getting information (availability of product from a manufacturer) from a soap web-service using WSDL.I’m stuck on getting the actual request through to the service, I tried the following.When I list the usable functions and data-types using:$client = new SoapClient( ‘<<<url omitted>>>’, array( ‘trace’=>1 ) ); echo ‘<pre>’; print_r( $client->__getFunctions() ); print_r( $client->__getTypes() ); echo ‘</pre>’;I get the following resp
sm13294
php soap wsdl soap-client envelope
I am trying to implement an email send function on php. The wsdl structure looks like this:<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:urn=”urn:nms:rtEvent”><soapenv:Header/><soapenv:Body><urn:PushEvent><urn:sessiontoken>mc/</urn:sessiontoken><urn:domEvent><rtEvent type=”type” email=”email” origin=”origin” wishedChannel=”0″ externalId=”” language=”DE” country=”DE” emailFormat=”2″><ctx><firstName>nam
Web site is in building