Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://x.x.x.x/magento/api/soap/?wsdl' : Start tag expected, '<' not found in
We used SOAP api version 1 in magento working in local perfectly (windows environment) and not in server (Linux).
PHP soap and xml-rpc in enabled in server.
By the looks of it you have an error in some xml somewhere, or your not getting the wsdl file returned. If you visit the wsdl URL manually do you actually get the wsdl xml definitions? Check this first. If so, run it through an xml validator to check it's valid. From the fact it's looking for an '<' tag, I suspect you are not getting the wsdl file returned, but an error instead so check your magento error logs. Also, from memory, I think you might need to setup a host entry on the server to your site as well, I have seen this before and that has resolved it. Magento's soap controller initiates a connection to the wsdl file when you make a request and it might not be able to resolve to itself.
I don't know which version of Magento are you using, but there is a SOAP patch for Magento 1.9.x
Related
Is there a tool that I can use to validate my web.config? The reason I ask is that the file appears to be valid XML and IIS is complaining that file is invalid. No explanation or indication as to why.
Thanks in advance.
Edit:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information:
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x8007000d
Config Error
Config File \?\C:\DignityFiles\Source\simplicity\Simplicity\web.config
Requested URL http://simplicity-local.dignitytest.co.uk:80/
Physical Path
Logon Method Not yet determined
Logon User Not yet determined
Config Source:
-1:
0:
More Information:
This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.
View more information ยป [This takes you to "https://support.microsoft.com/en-gb/help/942055/-http-error-500-19-error-when-you-open-an-iis-7-0-webpage"]
Link to the web.config (Note: sensitive information has been redacted)
I have (eventually) found the answer: https://stackoverflow.com/a/41267673
Installing the URL rewrite module fixed my issue.
This answer addressses the immediate concern, but if you are looking for a general solution in powershell I have created a function that addresses this.
The full answer is here: how do i validate an IIS web.config in powershell
But the gist of it is you have to find all the "filters" and test each of them individually via Get-WebConfiguration
I have a Web API project along with the built in help website. When I start up the project locally, the help website home page displays no problem. But when I send a REST POST request to an API controller using fiddler, I get the following response.
The following errors occurred while attempting to load the app.
- No assembly found containing an OwinStartupAttribute.
- No assembly found containing a Startup or [AssemblyName].Startup class.
To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web.config.
To specify the OWIN startup Assembly, Class, or Method, add the appSetting owin:AppStartup with the fully qualified startup class or configuration method name in your web.config.
I have tried to solve using the suggestions in the error message but no joy.
It works OK on the test server.
Can anyone suggest why this error is returned only on a REST request and not when the help website starts up and any tips on how to solve?
I am trying to connect Magento with Shipworks, for that i have downloaded shipworks3.php file which is required for the integration,
and i have put the file in the c://wamp/www/magento/shipworks3.php, that time Shipworks giving me message that it requires SSL required, to resolve that i made my apache SSL enable using IIS7, so it will use the https:// url ,
error resolved that time but got new error, about
the remote server returned an error (405) method not allowed
I have searched a lot but found nothing, can anyone sort it out,
Thanks in advance.
I just upgraded my Breeze nuget package from 1.1.3 to 1.2.7. I was getting error about some of my classes that had "ComplexType" items, so after upgrade I am getting the error below when reading the Metadata from my MVC4 Web API. Everything was working properly before that with the exception of ComplexType, so I know for sure everything is in place, since I was getting the Metadata, and was able to show the data on the screen.
Uncaught SyntaxError: Unexpected token o
Uncaught SyntaxError: Unexpected token o breeze.debug.js:12561
ctor.fetchMetadata.ajaxImpl.ajax.success breeze.debug.js:12561
jQuery.Callbacks.fire jquery-1.9.1.js:1037
jQuery.Callbacks.self.fireWith jquery-1.9.1.js:1148
done jquery-1.9.1.js:8074
jQuery.ajaxTransport.send.callback
I was having the exact same problem and I noticed that when you issue a GET against the metadata location (/api/Context/Metadata), it returned an xml document formatted as json. I also think there is a related question, but in a slightly different context. In this case however, the error was raised at ctor.prototype.fetchMetadata in a line containing JSON.parse(). But I'm pretty sure is the exact same underlying cause.
Just update Breeze from Nuget (both the the dll and the js files) and that would do the trick.
Notice that you might have to manually delete the breeze files from the /Scripts folders.
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: can't import schema from 'http://schemas.xmlsoap.org/soap/encoding/'
First, I am sorry to say I put these question here cause so many same question in stackoverflow. But it seems not any fit for me.
I use Magento SOAP2 API for times, this error not happed often. But it keeps make a fatal error when I run my script today.
I have looked up for some method to solve this problem, for example, some articles told me to change this code in /app/code/core/Mage/Api/etc/wsdl.xml
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemalocation="http://schemas.xmlsoap.org/soap/encoding/">
</import>
to this
<!--
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
-->
I followed this, but it make another error like below,
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: unexpected <import> in schema
Then I have no idea what's wrong, cause this script is always running perfectly but today and I even do not change any line of the code. My question is,
1, Any method to solve it?
2, Can I make this xmlsoap.org xml file to localhost or my own server so that my script will not depend on a file out my server.
Thank you in advance!
First of all, please never tamper with the default elements of any Magento API V2 WSDL Configuration file. It's a basic rule.
Please keep in mind to write these following elements at the beginning of each custom WSDL file or make sure that these following elements are present at the beginning of the WSDL file of your target existing module:-
"definition" element (<definitions> - start tag)
"types" element (<types> - start tag)
"schema" element (<schema> - start tag)
"import" element (<import /> - singleton tag, with no end tag)
Then you can continue with defining the Complex Data Types of the Magento API V2 for that Custom Module.
You can very well get the concept of all these by looking into some of the existing Magento API V2 WSDL files.
Now coming back to your questions...
1. Any method to solve it?
As I said before, please maintain the above-mentioned elements definitions at the beginning of your WSDL file.
The "import" statement should have been:-
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
with no end tag.
Also the attribute name is "schemaLocation" & not "schemalocation". Follow the Camel Casing please.
2. Can I make this xmlsoap.org xml file to localhost or my own server so that my script will not depend on a file out my server?
Yes you can, but you need to know & maintain two vital points:-
Both of the attributes "namespace" & "schemaLocation" must be of type URI, according to the W3C specifications. So your local files for both of these attributes must also be accessible in your local browser, using HTTP protocol.
If you are maintaining it in your local hard disk, then you are forgetting about one golden rule of upgradation, for Schema of the SOAP/1.1 encoding file. This is because if (only if) W3C upgrades this file in this same URI, then your Magento will be able to take it automatically if the general URI is provided; otherwise you will need to download that upgraded file again to your server.
Other than these two major points, everything is okay & you are good to go.
Nevertheless, I hope that I have answered all your queries. Hope it helps.
Use code like,
//create soap object
`$proxy = new SoapClient('http://localhost/magento/index.php/api/soap/?wsdl');`
// create authorized session id using api user name and api key
$sessionId = $proxy->login('apiUser', 'apiKey');
$productinfo = $proxy->call($sessionId, 'product.info',16);
echo "<pre>";print_r($productinfo);
Just some details for accepted solution.
Enter the address of the schema location in your browser:
http://schemas.xmlsoap.org/soap/encoding/
Save the XML result in the browser in a file called encoding.xsd (save file as).
Copy this file to your magento web root directory e.g. /var/www/magento/
Search for all schemaLocation entries in wsd*.xml files from magento root folder with e.g. find . -name "wsdl*.xml" | xargs grep schemaLocation 2>/dev/null | grep org
On my system 12 matching files in ./app/code/core and 2 matching files from 3rd party extensions in ./app/code/local.
Change the line in every matching xml file
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"
schemalocation="http://schemas.xmlsoap.org/soap/encoding/">
to
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="../../../../encoding.xsd">
Remark: In this case the encoding.xsd file is 4 directories higher relativ to the api path of http://sampleshop.com/testsystem/index.php/api/v2_soap/?wsdl
In your live system 2 (without index.php) or 3 (with index.php) times "../" could be correct.
Try the SOAP calls from local and remote server
Example Script
<?php
$proxy = new SoapClient('http://sampleshop.com/testsystem/index.php/api/v2_soap/?wsdl');
$sessionId = $proxy->login('MagentoSoapUser', 'SoapApiKey');
$result = $proxy->directoryCountryList($sessionId);
var_dump($result);
?>
This solutions worked for me, just wanted to add some details as it takes me some time to get it running.
System: magento CE 1.7.0.2
SOAP: php-soap with php version 5.3 on magento server and 5.6 on remote server.
Kozure