2017-07-04 8 views
0

に私はC#のWebサービスを持っていない、それは非常に簡単です、シンプルなC#のWebサービスはローカルで動作しますが、サーバー

私は外部のWSDLを使用するWeb参照を持って、

が会社のマシン上でローカルに動作しますが、ではありません会社のサーバー上で

これはプロキシ関連の可能性がある他の投稿を見ましたが、プロキシに関するwebconfigの編集には疲れましたが、私は専門家の助けが必要です。

ブラウザを使用してWebサービスがサーバー上で実行されているときに「invoke」を押すと、「リモートサーバーに接続できません」というエラーが表示されます。私は正常に接続することができたサーバー用の会社のファイアウォールにいくつかの調整後

<?xml version="1.0" encoding="utf-8" ?> 
<string xmlns="http://www.service-now.com/CatalogUpdateAutomationVariables">Unable to connect to the remote server</string> 

WEB CONFIG

<?xml version="1.0"?> 
<!-- 
    For more information on how to configure your ASP.NET application, please visit 
    http://go.microsoft.com/fwlink/?LinkId=169433 
    --> 
<configuration> 
    <configSections> 
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
     <section name="InboundServiceNowWeb.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> 
    </sectionGroup> 
    </configSections> 
    <system.web> 
    <compilation targetFramework="4.5.2" debug="true"/> 
    <httpRuntime targetFramework="4.5.2"/> 
    <customErrors mode="Off"/> 
    <webServices> 
     <protocols> 
     <add name="HttpGet"/> 
     <add name="HttpPost"/> 
     </protocols> 
    </webServices> 
    </system.web> 
    <system.codedom> 
    <compilers> 
     <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/> 
     <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/> 
    </compilers> 
    </system.codedom> 
    <system.serviceModel> 
    <bindings/> 
    <client/> 
    </system.serviceModel> 
    <applicationSettings> 
    <InboundServiceNowWeb.Properties.Settings> 
     <setting name="InboundServiceNowWeb_ServiceNowDev_ServiceNow_CatalogUpdateAutomationVariables" serializeAs="String"> 
     <value>https://COMPANY.service-now.com/CatalogUpdateAutomationVariables.do?SOAP</value> 
     </setting> 
    </InboundServiceNowWeb.Properties.Settings> 
    </applicationSettings> 
    <system.net> 
    <defaultProxy enabled="true" useDefaultCredentials="false" /> 
    </system.net> 
</configuration> 
<!--ProjectGuid: {55A9796B-1C01-4454-B0C3-942C1C8221B5}--> 

C#

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.Services; 

namespace InboundServiceNowWeb 
{ 
    /// <summary> 
    /// Summary description for ServiceNowInboundSOAP 
    /// </summary> 
    [WebService(Namespace = "http://www.service-now.com/CatalogUpdateAutomationVariables")] 
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] 
    [System.ComponentModel.ToolboxItem(false)] 
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService] 
    public class ServiceNowInboundSOAP : System.Web.Services.WebService 
    { 

     [WebMethod] 
     public string UpdateCatalogRITM(string RITM, string ReturnCode, string ReturnMessage, string Comment) 
     { 
      // return "Hello World1"; 
      /* 
      //SERVICE REFERENCE-SPECIFIC CODE 
      ServiceNowDev.ServiceNowSoapClient soapClient = new ServiceNowDev.ServiceNowSoapClient(); 
      soapClient.ClientCredentials.UserName.UserName = "sys_ws_catalog"; 
      soapClient.ClientCredentials.UserName.Password = "#####"; 

      ServiceNowDev.update insert = new InboundServiceNowWeb.ServiceNowDev.update(); 
      //ServiceNowDEV.update response = new ServiceNowDEV.updateResponse(); 
      ServiceNowDev.updateResponse response = new InboundServiceNowWeb.ServiceNowDev.updateResponse(); 
      */ 
      // WEB REFERENCE-SPECIFIC CODE 
      ServiceNowDev.ServiceNow_CatalogUpdateAutomationVariables soapClient = new InboundServiceNowWeb.ServiceNowDev.ServiceNow_CatalogUpdateAutomationVariables(); 
      System.Net.ICredentials cred = new System.Net.NetworkCredential("sys_ws_catalog", "catalog01"); 
      soapClient.Credentials = cred; 

      ServiceNowDev.update insert = new ServiceNowDev.update(); 
      ServiceNowDev.updateResponse response = new ServiceNowDev.updateResponse(); 
      // END OF WEB REFERENCE CODE */ 

      insert.RequestNumber = RITM; 
      insert.ReturnCode = ReturnCode; 
      insert.ReturnMessage = ReturnMessage; 
      insert.Comments = Comment; 

      try 
      { 
       response = soapClient.update(insert); 
       return response.result; 

      } 
      catch (Exception error) 
      { 
       return error.Message; 
       // this.Response.Text = error.Message; 
      } 
     } 
    } 
} 
+0

"エラーが発生しました"リモートサーバーに接続できません " - *どこで*エラーが表示されますか?あなたのブラウザはそれに接続できない、あるいは他の何かに接続できないことを意味しますか?同じサーバー上で他のWebアプリケーションを使用していましたか?すぐに私たちのために情報が少なすぎるだけです... –

+0

ブラウザで実行しているときにサーバー上でエラーが発生しています –

+0

申し訳ありませんが、それは明確ではありません。 「サーバー上でエラーが発生する」というのは、正確ではありません。 *あなたの質問を編集して、あなたが見ているものについて非常に明確にしてください。 –

答えて

0

あなたのおかげでありがとう

関連する問題