1

同じWCFサービスの2つのインスタンスがあります。1つはVisualStudio2010(IIS Express)で実行され、もう1つはIISサーバー7で実行されます。PHP5ネイティブSOAP呼び出しを使用してサービスにアクセスしています。

Visual Studioインスタンスにアクセスしている間は、問題なく正常に動作します。ただし、IIS 7インスタンスにアクセスしようとすると、Uncaught SoapFault exception次のようになります。

PHP Fatal error:  SOAP-ERROR: Parsing Schema: can't import schema from 'http://example.com/WCFService/Service.svc?xsd=xsd0' in C:\\xampp\\htdocs\\synergy_client\\test.php on line 2
PHP Fatal error:  Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: can't import schema from 'http://example.com/WCFService/Service.svc?xsd=xsd0' in C:\\xampp\\htdocs\\synergy_client\\test.php:2\nStack trace:\n#0 C:\\xampp\\htdocs\\synergy_client\\test.php(2): SoapClient->SoapClient('[http://]example.com...')\n#1 {main}\n  thrown in C:\\xampp\\htdocs\\synergy_client\\test.php on line 2

サービスへのアクセスに使用されるPHPコードは次のとおりです。

<?php
$client = new SoapClient("[http://]example.com/WCFService/Service.svc?wsdl");
$result2 = $client->LoginAdmin(array('username' => "username",'password' => "password"));

IIS7インスタンスのweb.confは次のとおりです。

    <?xml version="1.0"?>
   <configuration>
    <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
    <assemblies>
        <add assembly=...../>
      </assemblies>
    </compilation>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>

Visual Studioインスタンスのweb.conf(期待どおりに実行されています):

    <?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>

.Netは初めてですので、問題を解決するためにあなたの助けが必要です。

追加情報:リンクを配置できないため、ローカルホストはhttp://のexample.com [http://]に置き換えられました。

編集: これは、ブラウザーでwsdlに直接アクセスするときに生成されるスクリプトです。

<wsdl:definitions name="Service" targetNamespace="http://tempuri.org/">
<wsdl:types><xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://localhost/WCFService/Service.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://localhost/WCFService/Service.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://localhost/WCFService/Service.svc?xsd=xsd2" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
</xsd:schema></wsdl:types><wsdl:message name="IService_LoginAdmin_InputMessage"><wsdl:part name="parameters" element="tns:LoginAdmin"/>
</wsdl:message>
.......
4

2 に答える 2

0

phpclientは、wcfサービスがホストされているのと同じサーバーで実行されていない可能性があるため、スキーマの場所を変更してください。serviceMetadataで変更できます。

<serviceMetadata httpGetEnabled="true" httpGetUrl="http://example.com/WCFService/Service.svc"  />

ソース: WCfサービスのwsdlファイルのデフォルトのスキーマ位置を変更するにはどうすればよいですか?

于 2013-02-12T13:51:07.853 に答える
0

解決策を手に入れました!それが言っていたように、あなたの迅速な対応と解決策を提案するための時間をありがとうLuuk

`can't import schema from http://example.com/WCFService/Service.svc?xsd=xsd0'

ブラウザからスキーマリンクにアクセスしようとしましたが、404エラーが発生しました。次に、そのためにグーグルで検索し、次の解決策を見つけました。

Allow access for IIS_IUSERS to the folder 'C:/Windows/Temp'

この答えが誰かを助けることを願っています。

于 2013-02-15T10:16:49.203 に答える