0
votes

I try to load magento web service from https://myclient.com/api/v2_soap/index/wsdl/1 into my .net console testing application. I added service reference and it generated basichttpbinding in the app.config file with the endpoint.

however when i tried to login, i got this error: "SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://myclient.com/index.php/api/v2_soap/index/wsdl/1/' : Start tag expected, '<' not found"

Any ideas?

System.ServiceModel.FaultException was unhandled
  HResult=-2146233087
  Message=SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://myclient.com/index.php/api/v2_soap/index/wsdl/1/' : Start tag expected, '<' not found

  Source=mscorlib
  StackTrace:
    Server stack trace: 
       at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    Exception rethrown at [0]: 
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

app.config:

<?xml version="1.0"?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="Mage_Api_Model_Server_V2_HandlerBinding" closeTimeout="00:01:00"
           openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"      
           maxBufferPoolSize="524288000" maxBufferSize="65536000" maxReceivedMessageSize="65536000">
          <security mode="Transport" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>

      <endpoint address="https://myclient.com/api/v2_soap/index/wsdl/1"
          binding="basicHttpBinding" bindingConfiguration="Mage_Api_Model_Server_V2_HandlerBinding"
          contract="TattyService.Mage_Api_Model_Server_V2_HandlerPortType"
          name="Mage_Api_Model_Server_V2_HandlerPort" />
    </client>
  </system.serviceModel>
</configuration>

program.cs:

 using (Mage_Api_Model_Server_V2_HandlerPortTypeClient proxy = new Mage_Api_Model_Server_V2_HandlerPortTypeClient())
            {
                proxy.login("username", "apikey");
            }
2
What if you change to https? can you access the wsdl using a browser?Kaido
How about some code/config file? Hard to see what could be wrong.retslig
@Kaido if I change to https, it throws me "Unrecognized message version." yeah, i can access it using a browser, just an xml fileKiddo
@retslig: config file attachedKiddo
So the config you've attached throws unrecognised message version? I think that's normally caused by a 404. Do both http and https work in browser? The address in your config does not match the one in your SOAP-ERRORKaido

2 Answers

0
votes

By this phrase of the error "Start tag expected, '<' not found", the basic problem must be the missing of the XML Start tag in probably the Magento file "wsdl.xml".

I practically don't know the easiest solution, but you can definitely go through each line manually after you have loaded the WSDL in your browser successfully. Based on the line of the error, you will have to identify the Magento module, and then rectify this defect.

Hope it helps.

0
votes

it turned out to be the web host added extra layer of SSL which most of machine doesn't have it installed. that's when browser can browse it but not VS.