首页 > C#

远程服务器返回错误: (400) 错误的请求

由于语法格式有误,服务器无法理解此请求。不作修改,客户程序就无法重复此请求。
AQ = "<?xml version=\"1.0\"?>" +
            "<!DOCTYPE REQ SYSTEM \"LOCREQ.DTD\">"+
            "<REQ>" +
            "<CLIENT>" +
            "<LCSCLIENTID>10023005</LCSCLIENTID>" +
            "<PASSWORD>123456</PASSWORD>" +
            "</CLIENT>" +
              "<ORIGINATOR>" +
                "<ORID>13300000001</ORID>" +
                "<ORID_TYPE>0</ORID_TYPE>" +
              "</ORIGINATOR>" +
              "<REQ_PLATFORM>1</REQ_PLATFORM>"+
              "<SERVICEID>cqlt</SERVICEID>"+
              "<LIR>" +
                "<ORIGUSER_ACCESSTYPE>3</ORIGUSER_ACCESSTYPE>" +
                "<FINDME_INDIC>0</FINDME_INDIC>" +
                  "<MSIDS>" +
                    "<MSID>18608514731</MSID>" +
                    "<MSID_TYPE>0</MSID_TYPE>" +
                    "<QUERYPASSWORD>123456</QUERYPASSWORD>" +
                  "</MSIDS>" +
                  "<POSREQTYPE >2</POSREQTYPE >" +
                  "<GEO_INFO>" +
                    "<COORD_SYS>LL</COORD_SYS>" +
                    "<DATUM>WGS-84</DATUM>" +
                    "<LL_FORMAT>DMS3</LL_FORMAT>" +
                  "</GEO_INFO>" +
                  "<PQOS>" +
                    "<RESP_REQ>LOW_DELAY</RESP_REQ>" +
                    "<HOR_ACC>100</HOR_ACC>" +
                    "<ALT_ACC>200</ALT_ACC>" +
                  "</PQOS>" +
                  "<PRIO>1</PRIO>" +
                "</LIR>" +
            "</REQ>";

剩下只能找服务端查了。

1.确认ContentType
2.确认是POST还是GET
3.确认XML是否正确。

应该是配置的问题
服务端:

<system.serviceModel>
    <services>
      <service name="WcfService.HttpService" behaviorConfiguration="httpbehavior">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8888"/>
          </baseAddresses>
        </host>
        <endpoint address="" binding="basicHttpBinding" contract="WcfService.IHttpService" behaviorConfiguration="Ebehavior">
        </endpoint>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="httpbehavior">
          <serviceMetadata httpGetEnabled="true" httpGetUrl="mex"/>
          <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="false"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="Ebehavior">
          <!--<webHttp/>-->
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding  maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"  sendTimeout="00:10:00" >
          <!--<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"  />-->
          <security mode="None"></security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" ></serviceHostingEnvironment>
  </system.serviceModel>

客户端:

<system.serviceModel>
    <services>
      <service name="WcfService.HttpService" behaviorConfiguration="httpbehavior" >
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8888"/>
          </baseAddresses>
        </host>
        <endpoint address="" binding="basicHttpBinding" contract="WcfService.IHttpService" behaviorConfiguration="Ebehavior">
        </endpoint>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="httpbehavior">
          <serviceMetadata httpGetEnabled="true" httpGetUrl="mex"/>
          <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="false"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="Ebehavior">
       
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding name="webBinding"  maxBufferPoolSize="5147483647" maxBufferSize="65536000" maxReceivedMessageSize="2147483647"  sendTimeout="00:10:00" >
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"  />
          <security mode="None"></security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"></serviceHostingEnvironment>
  </system.serviceModel>


本文由用户 【大数据】 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。

转载本站原创文章,请注明出处,并保留原始链接、图片水印。

本站是一个以用户分享为主的开源技术平台,欢迎各类分享!

本文地址:http://www.mj85.com/csharp/233.html

分享:

评论 [共0条评论]

  • 这篇文章还没有收到评论,赶紧来抢沙发吧~

您现面为匿名用户,暂不能发表评论。如想评论则请登录注册

相关内容

发布者

大数据 发于:

19年/05月/23日 09时

查看次数: 275

标签 Tags

(400) 错误

谁收藏了?

0人已收藏