C# SOAP-ERROR: Parsing WSDL: Couldn't load from - c#

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");
}

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.

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.

Related

WCF service access from client application not working in windows container

I have a WCF service that is hosted on localhost. This WCF service runs in the background to support another C# application that accesses that service. The communication works when the background is accessed locally from my local machine.
But when I try to containerize the entire setup of the background service and C# application, It starts throwing an error inside the WCF service i.e the proxy class.
I am getting the following eror:
Communication Exception on GetDCP, Ex: Server stack trace: at
System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message
reply, MessageFault fault, String action, MessageVersion version,
FaultConverter faultConverter) 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) at DPCS.GetDCP(String toolName) at
DPCSFormClient.MainForm.StartSessionAndGetDCP(Object entity,
DPCSClient& clientBatch, List`1& svidNameList) in
C:\tfs\E3\DPCS\DPCSFormClient\MainForm.cs:line 184
This is how my config file looks like:
<system.serviceModel>
<bindings>
<netNamedPipeBinding>
<binding name="NetNamedPipeBinding_DPCS" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="24.20:31:23.6470000" sendTimeout="00:05:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="1310700" maxConnections="10" maxReceivedMessageSize="1310700">
<readerQuotas maxDepth="32" maxStringContentLength="1310700" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="None">
<transport protectionLevel="None"/>
</security>
</binding>
</netNamedPipeBinding>
</bindings>
<client>
<endpoint address="net.pipe://localhost/Intel/E3/DPCSService" binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_DPCS" contract="DPCS" name="NetNamedPipeBinding_DPCS">
</endpoint>
</client>
</system.serviceModel>
And this is how my proxy class looks like:
public interface ABCD
{
[System.ServiceModel.OperationContractAttribute(Action="http://prox.A.ABCD/XYZ/StartSession", ReplyAction="http://prox.A.ABCD/XYZ/StartSessionResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(prox.A.ABCD.E3Fault), Action="http://prox.A.ABCD/Fault", Name="Fault", Namespace="http://schemas.datacontract.org/2004/07/prox.A.ABCD")]
void StartSession(string sessionXML);
[System.ServiceModel.OperationContractAttribute(IsInitiating=false, Action="prox.A.ABCD/XYZ/GetCon", ReplyAction="prox.A.ABCD/XYZ/DPCS/GetConResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(prox.A.ABCD.Fault), Action="http://prox.A.ABCD/Fault", Name="Fault", Namespace="http://schemas.datacontract.org/2004/07/prox.A.ABCD")]
string GetCon(string toolName);
only adding some part of code

Uploading via service and getting message endpoint not available on larger sized files

I have a WCF service running on a virtual machine. I haven't changed anything on this server or the service in quite some time. When I try to send up a file through the service that is ~25 mb I am getting this:
----------------------------------------------------------
DateTime: 1/24/2019 12:22:04 PM
ClassName: UploadPpsZipFile
Message: There was no endpoint listening at http://www.myservice.com/xxx/FileService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Server stack trace:
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
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)
at WebStorageFileTransfer.TruckTransferServiceReference.IFileService.UploadPpsZipFile(UploadFileRequest uploadFileRequest)
at WebStorageFileTransfer.ProgramTypes.SendZip.SendZip_Upload.UploadPpsZipFile(FileParms fileParms)
Unable to connect to the remote server
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
An attempt was made to access a socket in a way forbidden by its access permissions xxx.xxx.xxx.xxx:80
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
----------------------------------------------------------
My app.exe.config looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />
</startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IFileService" maxReceivedMessageSize="2147483647" sendTimeout="00:02:00">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://www.myservice.com/xxxx/FileService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileService" contract="TruckTransferServiceReference.IFileService" name="BasicHttpBinding_IFileService" />
</client>
</system.serviceModel>
</configuration>
When I send up a smaller file, such as a 1mb file, I have no issues. I have tested this on several computers and I get the same results.
Any suggestions?
There are 3 things that you can change in order to make it work :
IIS Host Settings:
I believe you have hosted the WCF service in IIS. Hence you need to set the
When sending large amounts of data you will need to set the maxAllowedContentLength IIS setting (for more information see Configuring IIS Request Limits)
This value defaults to ~28MB as far as I know.
Max Received Message Size:
You will have to change this to some other value (e.g. long.MaxValue). By default it is set to 64 KB.
Enable Streaming
By default the mode of transmission for WCF is buffered. While sending and receiving all data need to be present in memory - which would not be possible for large files.
Hence you will have to change the mode to "streaming" as shown below:
<system.serviceModel>
…
<bindings>
<basicHttpBinding>
<binding name="ExampleBinding" transferMode="Streaming"/>
</basicHttpBinding>
</bindings>
…
<system.serviceModel>
Refer the documentation.

WCF exception - Fault occurred while processing the request.

I am trying to access data via web service. My webservice calls works perfectly fine but sometimes it throws Fault occurred while processing the request. See fault detail for additional information exception
Here is my stacktrace of the error:
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)
I have tried increasing the readerQuotas inside my binding. Here is how my bindings looks
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IWS" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
<readerQuotas
maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="TransportWithMessageCredential" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://xxxx.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWS"
contract="ABC.IWS" name="BasicHttpBinding_IWS" />
</client>
Am I missing some configuration here ?
I had the same issue and the solution is to set all parameter(s) of the service being called. With SOAPUI app you might NOT notice it once. But as always, fiddler says the truth. For example, at first you think that "important_parameters" are enough to set for calling the service. And you think web-service considers(/sets itself) "EndTo" parameter is 0... Wrong! You ought to set it deliberately, otherwise you get the error mentioned in this post.
...
<important_parameters>
....
</important_parameters>
<Paging>
<EndTo>0</EndTo>
</Paging>
...
For me the first troubleshooting step was to get more information on the error. Because of the way Task responses work, there can be many inner exceptions. So change the handling code to log the inner exceptions.
var responseTask = client.someRemoteCall(request);
responseTask.ContinueWith(t =>
{
switch (t.Status)
{
case TaskStatus.Faulted:
foreach (var exception in t.Exception.Flatten().InnerExceptions)
{
log.Error(exception.Message);
if (exception.InnerException != null)
{
log.Error(exception.InnerException.Message);
}
}
break;
case TaskStatus.RanToCompletion:
{your success code}
default:
{some deafult error is thrown}
}
});

Binding error (binding mismatch?, security mismatch?) when calling a web service

Please forgive my lack of experience with WCF, but I'm having an issue with it that I am having some difficulty understanding.
Another organization at the company I work at has created a web service for me to consume. I believe I have correctly added a Service Reference to my project using the WSDL they provided. Their web service is based off of an Oracle API that I know very little of, I'm not an Oracle developer.
Here is the code I used to make use of the service reference:
BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
basicHttpBinding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential;
basicHttpBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
EndpointAddress epa = new EndpointAddress("https://MYENDPOINT.URL");
MyServiceReference.SERVICENAME_PortTypeClient port = new MyServiceReference.SERVICENAME_PortTypeClient(basicHttpBinding, epa);
port.ClientCredentials.UserName.UserName = SERVICE_U;
port.ClientCredentials.UserName.Password = SERVICE_P;
SOAHeader header = new SOAHeader();
header.Responsibility = SERVICE_RESPONSIBILITY;
InputParameters2 ip2 = new InputParameters2();
ip2.param1 = "abcd";
ip2.param2 = "1234"
OutputParameters2 output = port.WEB_SERVICE_FUNCTION(header, ip2);
Here the information in my Web.Config file regarding the binding information:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SERVICENAME_Binding">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://MYENDPOINT.URL"
binding="basicHttpBinding" bindingConfiguration="SERVICENAME_Binding"
contract="MyServiceReference.SERVICENAME_PortType"
name=SERVICENAME_Port" />
</client>
</system.serviceModel>
When the call is made to the service I get the following error:
Security processor was unable to find a security header in the
message. This might be because the message is an unsecured fault or
because there is a binding mismatch between the communicating parties.
This can occur if the service is configured for security and the
client is not using security.
With the following stacktrace:
at System.ServiceModel.Security.TransportSecurityProtocol.VerifyIncomingMessageCore(Message& message, TimeSpan timeout)
at System.ServiceModel.Security.TransportSecurityProtocol.VerifyIncomingMessage(Message& message, TimeSpan timeout)
at System.ServiceModel.Security.SecurityProtocol.VerifyIncomingMessage(Message& message, TimeSpan timeout, SecurityProtocolCorrelationState[] correlationStates)
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.ProcessReply(Message reply, SecurityProtocolCorrelationState correlationState, TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
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)
at MyProject.MyServiceReference.SERVICE_NAME_PortType.WEB_SERVICE_FUNCTION(WEB_SERVICE_FUNCTIONRequest request)
at MyProject.MyServiceReference.SERVICE_NAME_PortTypeClient.MyProject.MyServiceReference.SERVICE_NAME_PortType.WEB_SERVICE_FUNCTION(WEB_SERVICE_FUNCTIONRequest request) in c:\MyProject\Service References\MyServiceReference\Reference.cs:line 981
at MyProject.MyServiceReference.SERVICE_NAME_PortTypeClient.WEB_SERVICE_FUNCTION(SOAHeader SOAHeader, InputParameters2 InputParameters) in c:\MyProject\Service References\MyServiceReference\Reference.cs:line 988
at MyProject.MyClass.MyFunction(String inputParam) in c:\MyProject\MyClass.asmx.cs:line 160
After looking at the stack trace, it appears that the verification of the response may be the issue which lead me to believe that it may have to do with a timestamp issue that others have had (ex. http://blog.latamhub.com/?p=78) may be the issue, but when I try to add the includeTimestamp="true" attribute to the security tag in the Web.Config file, VS2012 reports that the includeTimestamp attribute is not allowed. Not quite certain what is going on here or what else to check. Any help or ideas are greatly appreciated.
Thanks.
EDIT (2013-05-30):
Tried the following custom binding with the includeTimestamp set to true and false with no success:
<customBinding>
<binding name="SERVICENAME_Binding">
<security
includeTimestamp="true"
/>
</binding>
</customBinding>

trying to consume wcf service but I think my web.config file is incorrect

I am having try trying to consume a service. I am trying to deploy it to a server and consume it however I get this error. I have created a web application and added a wcf service. I am getting this
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
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)
at IBusinessV1.CheckForUpdate(String currentVersion)
at BusinessV1Client.CheckForUpdate(String currentVersion)
Is there something wrong with my config?
<system.serviceModel>
<services>
<service name="SP.WebWCF.Business_v1">
<endpoint
address="https://services.mydomain.com"
binding="basicHttpBinding"
bindingConfiguration=""
contract="SP.WebWCF.IBusiness_v1"
listenUri="/" isSystemEndpoint="true" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
Ok, so your did show the server config, but you never really told us what the error is - you show the stack trace - but not the error message.....
Anyway, looking at your service config, one thing seems a bit odd - your service address:
address="https://services.mydomain.com"
binding="basicHttpBinding"
Typically this would either be something like
address="https://services.mydomain.com/MyServiceVirtualDir/MyService.svc"
if you're hosting your service inside IIS, or something like
address="https://services.mydomain.com/MyService"
if you're self-hosting in a Windows NT service or something.
Can you double-check your address - are you 100% sure it's correct??
Update: also, you're using https://, however, you're not showing any security-settings in your service config. Just for test: can you invoke your service when you change the service address in the config to just http:// ??

Categories

Resources