I have successfully managed to run many php (NuSOAP) web services from VB.NET, however I am unable return an array without the following error:
"There is an error in XML document (1, x)."
For the following three instances, I am able to get it working from php to php (NuSOAP), but from VB.NET to php(NuSOAP), it always returns the above error. These are the three examples.
xsd:Array
$server->wsdl->addComplexType(
'ArrayOfString',
'complexType',
'array',
'sequence',
'',
array(
'itemName' => array(
'name' => 'itemName',
'type' => 'xsd:string',
'minOccurs' => '0',
'maxOccurs' => 'unbounded'
)
)
);
$server->wsdl->addComplexType(
'Users',
'complexType',
'struct',
'all',
'',
array( 'Users' => array('name' => 'UsersIn',
'type' => 'xsd:Array'))
);
Is this a limitation, or is there something else I can do? Thanks
Edit:
OK, I've searched far and wide for this issue and seen so many that have tried to solve it but none succeed. It appears to be a.NET issue possibly due to php communication, so I would rule out NuSOAP because I hardcoded the same thing in pure php and it resulted in the same problem.
I have also looked at the xml files returned by SOAP and they all validated while the error locations were in pretty harmless locations. I think possibly the xml file it is looking at may not actually be the one returned by SOAP but something else or otherwise recently serialized, the reference is, 'System.Xml.dll'.
I also played around with some basic encoding on the database and SOAP server but that didn't change the result.
Related
I'm writing a library to connect to Twitter that uses Requests for PHP. I'm not sure, but I don't think that I'm building the OAuth correctly because I can't authenticate. I've double-checked it, and checked it against another existing library but still can't seem to get it right.
The code is here.
The idea is you instantiate the service, send it config parameters, and before it does the request, it generates the 'Authorization: OAuth xxx' header and adds it to said request.
$twitter = array(
'consumer_key' => '',
'consumer_secret' => '',
'access_token' => '',
'access_token_secret' => '',
'screen_name' => '_hassankhan',
'api_url' => 'https://api.twitter.com/1.1/'
);
$service = new OAuth1AService('Twitter', $twitter['api_url']);
$service->config($twitter);
$service->doGet(
'statuses/user_timeline.json',
array(
'screen_name' => '_hassankhan',
'include_entities' => 'true'
),
array(),
'raw'
);
print($service->getResult());
I would really recommend you to use one of the already made libraries like tmhOAuth which make it really easy to interact with the twitter api.
As for your problem, seems you don't sign your request correctly. At least I could not easily find out if you include all request parameters to create the signature.
The oauth_signature parameter contains a value which is generated by
running all of the other request parameters and two secret values
through a signing algorithm.
Creating the signature is described in this document: https://dev.twitter.com/docs/auth/creating-signature .
I am trying to use the CI-Merchant library for codeigniter. I have installed this via a spark, as recommended. The documentation example that is on the ci-merchant.org website does not specifically show the spark being loaded, and therefor I am uncertain that I am using the system correctly. Can anyone look at the code below and see if they can spot what is going on. I wish to use "sagepay server" as my merchant in case that is helpful.
Regards and thanks in antipation
$this->load->spark('ci-merchant-2.1.1');
$this->load->library('merchant');
$this->merchant->load('sagepay_servber');
$settings = array(
'vendor' => 'fluidbrandinglt',
'test_mode' => TRUE,
'simulator_mode' => FALSE
);
$this->merchant->initialize($settings);
$params = array(
'amount' => 100.00,
'currency' => 'USD',
'return_url' => 'https://www.example.com/checkout/payment_return/123',
'cancel_url' => 'https://www.example.com/checkout'
);
$response = $this->merchant->purchase($params);
When I run the above code, I just get a blank screen with zero feedback about what is going on. I know that I have an encryption password which Sagepay provided me, but again I cannot see where this is configured or even if its relevant.
You should change
$this->merchant->load('sagepay_servber');
with.
$this->merchant->load('sagepay_server');
There is a 'b' in your load statement. Small detail but it does give headaches.
Currently when attempting a coupon (POST) at resource "/coupon.json" we are getting the following return JSON:
Response Code:
{"status":400,"message":"The field 'id' cannot be written to. Please remove it from your request before trying again."}
The "ID" field is obviously no where in our code but we are still receiving this error.
In to this addition we thought it might be from the "applies_to" as that object resource contains an "ids" element but we disabled that and still received the same effect.
At this time it is our best guess that this is a bug on the server side that is registering incoming JSON for the coupon resource with an "ID" point on it.
Question: Is creating a coupon currently possible?
It is possible to create coupons. I got it working both from a php script and using the developer playground at https://developer.bigcommerce.com/console
$coupon = array('name' => 'FJKDJFKD', 'type' => 'percentage_discount', 'amount' => 50.0, 'code' => 'JFKDFE', 'enabled' => true, 'applies_to' => array('entity' => 'products', 'ids' => array(32)), 'shipping_methods' => array());
print_r($coupon);
Screenshots from the playground -
I'm currently developing an web application which uses an XML Interface located on a different server, that I have to access via a proxy.
So I tried to set the proxy in a stream_context_create array, but it doesn't seem to work.
$set = array(
'http' => array(
'method' => 'GET',
'header' => sprintf(
'Proxy-Authorization: Basic %s',
base64_encode(Constants::XML_AUTH)
),
'protocol_version' => '1.1',
'proxy' => '89.122.180.178:46565'
)
);
$stream = stream_context_create($set);
I'm not quite sure what I'm doing wrong.
If I comment out the proxy key i get a 403 Forbidden Response as it should be.
If I comment in the proxy key I receive a 400 Bad Request Response.
I'm not quite sure what I'm doing wrong. Can you help me out? I never did a communication through a proxy before with PHP.
My guess is that the proxy declaration is missing the protocol. An URI has to be specified (according to the doc), that contains the protocol (scheme).
So this could work: 'proxy' => 'tcp://89.122.180.178:46565'. It might be necessary to remove 'protocol_version' since this may not be required for tcp.
Does that work for you? (or have you already solved it? ... ;-)
I'm programming an API of sorts on a PHP website I built with the goal that another programmer can send data (POST and FILES date) to my PHP website from their iPhone app so that I can process the data and return some of my own.
We've been struggling to find a way that he can send POST data (though we found a pretty hacky workaround) and FILES data from the iPhone app. The goal on my end would be to receive a POST array and a FILES array similar to (in PHP of course):
$_POST = array(
'key' => 'key-value-here',
'token' => 'token-value-here',
'id' => 'id-value-here'
'values' => array(
'name' => 'Name value here',
'description' => 'Description value here'
)
);
$_FILES = array(
'photo' => array(
'name' => 'photo-name.jpg',
'type' => 'image/jpeg',
'tmp_name' => '/tmp/path',
'error' => '0',
'size' => '12345'
)
);
Any help you could offer us on how we could send such data would be greatly appreciated. Also, the iPhone app programmer is trying to avoid using the ASIHTTPRequest library for now (for a number of reasons).
Just create a multi-part post. For how it should look like, see a multi-part message. I have never worked with the iPhone, so I couldn't tell you which library could do this, but if all else fails, it's just an open socket connection & some string manipulation...