2008-10-03 22 views
12

私たちのサーバーのWindowsサービスでWCFサービスをホストしています。 basicHttpBindingで動作させ、.NETでテストクライアントを構築した後(私は最終的に動作しました)、SoapClientクラスを使用してPHPからアクセスしようとしました。最終消費者はPHPサイトになりますので、PHPで消耗させる必要があります。Windowsサービス内でホストされているWCFサービス(basicHttpBinding)のWSDL URL

PHPコードのSoapClientクラスのコンストラクターにWSDL URLを入力する必要があるときに、困惑しました。 WSDLはどこですか?私が持っているすべては、次のとおりです。これらの

http://172.27.7.123:8000/WordServicehttp://172.27.7.123:8000/WordService/mex

なしWSDLを公開しません。

WCFで初心者だったので、私は愚かなことを尋ねたかもしれません(あるいは私は間違った前提をどこかに持つかもしれません)。優しくしてください:D

そして、いや、http://172.27.7.123:8000/WordService?wsdlhttp://172.27.7.123:8000/WordServiceとは異なる何も表示されません:(

私はIISでそれをホストするために強制的にアム私は定期的にWebサービスを使用するように強制アム

+0

ニース。検索のおかげで、あなたの質問と回答が見つかりました –

答えて

9

これは役立つかもしれない:

http://msdn.microsoft.com/en-us/library/ms734765.aspx

簡単に言えば、サービスのエンドポイントと動作を設定する必要があります。最小の例を以下に示します。

<system.serviceModel> 
    <services> 

    <service 
     <!-- Namespace.ServiceClass implementation --> 
     name="WcfService1.Service1" 

     <!-- User behaviour defined below --> 
     behaviorConfiguration="SimpleServiceBehaviour"> 

     <endpoint 
     address="" 
     binding="basicHttpBinding" 
     <!-- Namespace.Interface that defines our service contract --> 
     contract="WcfService1.IService1"/> 

    </service> 
    </services> 
    <behaviors> 
    <serviceBehaviors> 
     <behavior name="SimpleServiceBehaviour"> 

     <serviceMetadata 
      <!-- We allow HTTP GET --> 
      httpGetEnabled="true" 

      <!-- Conform to WS-Policy 1.5 when generating metadata --> 
      policyVersion="Policy15"/> 

     </behavior> 
    </serviceBehaviors> 
    </behaviors> 
</system.serviceModel> 

ここで、XMLコメントは無効なので削除することを忘れないでください。

+2

申し訳ありませんが、リンクが壊れているようです。 –

+0

@Andrei:リンクはうまく見えますが、MSDNは週末のアップグレードや何かに行っている可能性があります。 – Kev

+0

ありがとう、今それは動作します:) –

1

参照してください?このリンク:

Exposing a WCF Service With Multiple Bindings and Endpoints

 
Unlike previous ASMX services, the WSDL (web service definition language) for WCF 
services is not automatically generated. The previous image even tells us that 
"Metadata publishing for this service is currently disabled.". 
This is because we haven't configured our service to expose any meta data about it. 
To expose a WSDL for a service we need to configure our service to provide meta information. Note: 
The mexHttpBinding is also used to share meta information about a service. While 
the name isn't very "gump" it stands for Meta Data Exchange. 
+0

ありがとうございました:) - あなたが指摘した文書でも、httpGetEnabledがtrueに設定されています。 –

関連する問題