首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >'http‘无效;预期’http‘

'http‘无效;预期’http‘
EN

Stack Overflow用户
提问于 2013-12-03 07:14:44
回答 1查看 1.7K关注 0票数 1

我一直试图向https://americas-uapi.copy-webservices.travelport.com/B2BGateway/connect/uAPI/SystemService发送ping请求,但我收到了以下错误:Error making ping request: The provided URI scheme 'https' is invalid; expected 'http'.

提供给我的端点使用https。如何纠正此错误?

这是我的web.config

代码语言:javascript
复制
<?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>

这是我按照教程发送的请求:

代码语言:javascript
复制
// 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;
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-12-03 07:17:40

代码语言:javascript
复制
<security mode="Transport"> in Servicereference.ClientConfig file

这里

在这里也检查一下

更新:根据您的评论:

代码语言:javascript
复制
 <bindings>
   <basicHttpBinding>
   <security mode="Transport">
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20345056

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档