I am attempting to call a SAP service using a WSDL file provided to me. I am getting this error:
Unexpected Packet Format
I have tested the service using SOAPUI and everything is working from there. When I call the service from my C# application I get the error referenced above.
Relative Information
Code
ZPC_DROP_DOWN_VALUESClient client = new ZPC_DROP_DOWN_VALUESClient();
client.ClientCredentials.UserName.UserName = "ERICO";
client.ClientCredentials.UserName.Password = "Password";
ZpcDropDownValues vals = new ZpcDropDownValues();
vals.Uom = "X";
ZpcDropDownValuesResponse Response = new ZpcDropDownValuesResponse();
try
{
Response = client.ZpcDropDownValues(vals);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Console.ReadKey();
Here is the stack trace:
System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at https://r3snd.yaskawa.com:8000/sap/bc/srt/rfc/sap/zpc_drop_down_values/410/zpc_drop_down_values/zpc_drop_down_values that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: The remote name could not be resolved: 'r3snd.yaskawa.com' at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at System.Net.HttpWebRequest.GetRequestStream() at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream() --- End of inner exception stack trace ---
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 ServicesFromSAP.TableReference.ZPC_DROP_DOWN_VALUES.ZpcDropDownValues(ZpcDropDownValuesRequest request) at ServicesFromSAP.TableReference.ZPC_DROP_DOWN_VALUESClient.ServicesFromSAP.TableReference.ZPC_DROP_DOWN_VALUES.ZpcDropDownValues(ZpcDropDownValuesRequest request) in C:\Users\eric_obermuller\source\repos\ServicesFromSAP\ServicesFromSAP\Connected Services\TableReference\Reference.cs:line 339 at ServicesFromSAP.TableReference.ZPC_DROP_DOWN_VALUESClient.ZpcDropDownValues(ZpcDropDownValues ZpcDropDownValues1) in C:\Users\eric_obermuller\source\repos\ServicesFromSAP\ServicesFromSAP\Connected Services\TableReference\Reference.cs:line 345 at ServicesFromSAP.Program.Main(String[] args) in C:\Users\eric_obermuller\source\repos\ServicesFromSAP\ServicesFromSAP\Program.cs:line 33
I am not sure what the issue is. This service was provided to me for testing/learning purposes so I could start learning how to use their services. Is there some kind of setting I am not aware of?
Any suggestions would be greatly appreciated. Not sure if I need to set the timeout to be longer or something along those lines. I have looked everywhere for an answer and it seems this is a case by case issue.
Alright I figured out the issue. Originally when testing this application the request was actually sent to me as an Http request.
Endpoint in App.Config
<endpoint address="http://R3SND.yaskawa.com:8000/sap/bc/srt/rfc/sap/zpc_drop_down_values/410/zpc_drop_down_values/zpc_drop_down_values"
binding="customBinding" bindingConfiguration="ZPC_DROP_DOWN_VALUES"
contract="TableReference.ZPC_DROP_DOWN_VALUES" name="ZPC_DROP_DOWN_VALUES" />
When I tried the application I got an error that said "Invalid URI Http, Https expected". Not quite knowing what was going on I changed my endpoint address to Https instead of Http. That is where the referenced error above happened.
While messing around I changed it back to Http and realized the error was being thrown because I was using HttpsTransport instead of HttpTransport.
Https Transport
<httpsTransport authenticationScheme="Basic" />
Http Transport(correct one)
<httpTransport authenticationScheme="Basic" />
I hope this can help someone else down the line because it was driving me insane!
Thank you all for looking at my question.