,你需要做的方式。
如果您在C#中使用RESTfull API,可以通过直接向服务发送直接HTTPS调用来完成。
但事情当您使用SOAP API
当你输入的Web服务程序,它包括以下根据您的申请意向XML代码在app.config或Web.config文件(Web应用程序变得复杂或独立应用程序)。
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ServiceNowSoap">
<security mode="Transport" />
</binding>
<binding name="ServiceNowSoap1" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://XXXXXXXX.service-now.com/service_subscribe_sys_user_list.do?SOAP"
binding="basicHttpBinding" bindingConfiguration="ServiceNowSoap"
contract="ServiceReference1.ServiceNowSoap" name="ServiceNowSoap" />
</client>
</system.serviceModel>
首先,如果您希望检索一大组记录,则需要增加最大接收邮件大小的大小。
为你需要编辑标签像下面
<binding name="ServiceNowSoap" maxReceivedMessageSize="2000000000">
接下来的部分是增加displayvalue =所有的URL。
我们不能用自己的XML编辑端点url,而是可以删除URL并将其添加为关键值。但你仍然不能添加URL参数与&标志你需要的值存储作为单独的按键,并结合其withing程序获取完整URL
最终XML会是这样
<configuration>
<appSettings>
<add key="serviceNowUrl"
value="https://XXXXXXXX.service-now.com/service_subscribe_sys_user_list.do?"/>
<add key="displayvalue" value="displayvalue=true"/>
<add key="protocol" value="SOAP"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ServiceNowSoap" maxReceivedMessageSize="2000000000">
<security mode="Transport">
<transport clientCredentialType="Basic" proxyCredentialType="Basic"
realm="">
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="ServiceNowSoap1" />
</basicHttpBinding>
</bindings>
<client>
<endpoint binding="basicHttpBinding" bindingConfiguration="ServiceNowSoap"
contract="Service_Now_Reference.ServiceNowSoap" name="ServiceNowSoap" />
</client>
</system.serviceModel>
</configuration>
你可以请按如下步骤组装url:
string url = ConfigurationSettings.AppSettings["serviceNowUrl"];
string protocol = ConfigurationSettings.AppSettings["protocol"];
string displayvalue = ConfigurationSettings.AppSettings["displayvalue"];
System.ServiceModel.EndpointAddress endpoint = new System.ServiceModel.EndpointAddress(string.Format("{0}{1}{2}", url, protocol, displayvalue));
嗨Sandaru,你能提供一些更多的细节吗?具体的URL是你要求吗? HTTP请求是什么样的?您是否从WSDL生成ServiceNowSoapClient? – Bryan
yah即时通讯使用WSDL。该网址是https://XXXXXXXX.service-now.com/service_subscribe_sys_user_list.do?WSDL – Sandaru
谢谢,仍然可以使用更多的信息来说肯定,但我猜测更新你拉WSDL的URL包括'displayvalue = all'(参考:http://wiki.servicenow.com/?title= Direct_Web_Services#Return_Display_Value_for_Reference_Variables)将有所帮助。如果您可以捕获您的C#应用程序发送的示例HTTP请求并将其包含在此处的问题中,它也将有所帮助。如果你这样做,请确保你删除标题中的任何凭据。 – Bryan