I have downloaded schema files from a service provider to test their API. I referenced the service in my ASP.NET application and wrote a simple method to send a ping request. I receive following error:
我从服务提供商处下载了模式文件以测试其API。我在ASP.NET应用程序中引用了该服务,并编写了一个发送ping请求的简单方法。我收到以下错误:
Error making ping request: There was no endpoint listening at http://localhost:8080/kestrel/SystemService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Does that mean I need to host the files too? If yes, how?
这是否意味着我还需要托管文件?如果有,怎么样?
EDIT:
编辑:
Here is my web.config
这是我的web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ExternalCacheAccessBinding" />
<binding name="SystemPingBinding" />
<binding name="SystemInfoBinding" />
<binding name="SystemTimeBinding" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://americas-uapi.copy-webservices.travelport.com/B2BGateway/connect/uAPI/SystemService"
binding="basicHttpBinding" bindingConfiguration="ExternalCacheAccessBinding"
contract="WSDLService.ExternalCacheAccessPortType" name="ExternalCacheAccessPort" />
<endpoint address="https://americas-uapi.copy-webservices.travelport.com/B2BGateway/connect/uAPI/SystemService"
binding="basicHttpBinding" bindingConfiguration="SystemPingBinding"
contract="WSDLService.SystemPingPortType" name="SystemPingPort" />
<endpoint address="https://americas-uapi.copy-webservices.travelport.com/B2BGateway/connect/uAPI/SystemService"
binding="basicHttpBinding" bindingConfiguration="SystemInfoBinding"
contract="WSDLService.SystemInfoPortType" name="SystemInfoPort" />
<endpoint address="https://americas-uapi.copy-webservices.travelport.com/B2BGateway/connect/uAPI/SystemService"
binding="basicHttpBinding" bindingConfiguration="SystemTimeBinding"
contract="WSDLService.SystemTimePortType" name="SystemtimePort" />
</client>
</system.serviceModel>
This is the request I am sending:
这是我发送的请求:
// PING REQUEST
//
String payload= "this my payload; there are many like it but this one is mine";
String someTraceId = "doesntmatter-8176";
//set up the request parameters into a PingReq object
PingReq req = new PingReq();
PingRsp rsp = new PingRsp();
req.Payload=payload;
req.TraceId=someTraceId;
SystemPingPortTypeClient port = new SystemPingPortTypeClient();
try {
//run the ping request
UserNamePasswordClientCredential creds = port.ClientCredentials.UserName;
creds.UserName = "MyUserName";
creds.Password = "MyPassword";
rsp = port.service(req);
//print results.. payload and trace ID are echoed back in response
Label1.Text = rsp.Payload;
Label2.Text = rsp.TraceId;
Label3.Text = rsp.TransactionId;
}
catch (Exception ex) {
//usually only the error message is useful, not the full stack
//trace, since the stack trace in is your address space...
Label1.Text = "Error making ping request: " + ex.Message;
1 个解决方案
#1
2
You are trying to connect to yourself (localhost). You need to get the public service address that they supply to publicly access the service.
您正在尝试连接自己(localhost)。您需要获取他们提供的公共服务地址以公开访问该服务。
I.e.:
即:
http://some.public.domain:8080/kestrel/SystemService
You should be able to hit the Service Reference in the browser by just navigating to the service url, and see the service methods. In this case, as in you web.config > https://americas-uapi.copy-webservices.travelport.com/B2BGateway/connect/uAPI/SystemService .
您应该只需导航到服务URL,即可在浏览器中点击服务参考,并查看服务方法。在这种情况下,就像在web.config> https://americas-uapi.copy-webservices.travelport.com/B2BGateway/connect/uAPI/SystemService中一样。
When I navigate to this URL, I get a "500" fault code. I'd start communicating with them about what you are receiving when just navigating to the URL in your browser.
当我导航到这个URL时,我得到一个“500”故障代码。当我在浏览器中导航到URL时,我会开始与他们讨论您收到的内容。
#1
2
You are trying to connect to yourself (localhost). You need to get the public service address that they supply to publicly access the service.
您正在尝试连接自己(localhost)。您需要获取他们提供的公共服务地址以公开访问该服务。
I.e.:
即:
http://some.public.domain:8080/kestrel/SystemService
You should be able to hit the Service Reference in the browser by just navigating to the service url, and see the service methods. In this case, as in you web.config > https://americas-uapi.copy-webservices.travelport.com/B2BGateway/connect/uAPI/SystemService .
您应该只需导航到服务URL,即可在浏览器中点击服务参考,并查看服务方法。在这种情况下,就像在web.config> https://americas-uapi.copy-webservices.travelport.com/B2BGateway/connect/uAPI/SystemService中一样。
When I navigate to this URL, I get a "500" fault code. I'd start communicating with them about what you are receiving when just navigating to the URL in your browser.
当我导航到这个URL时,我得到一个“500”故障代码。当我在浏览器中导航到URL时,我会开始与他们讨论您收到的内容。