2010-12-03 8 views
0

Visual StudioのC#アプリケーションにWebサービス参照を追加しようとしています。 WebサービスはSunのGlassFishサーバーでホストされています。私は、サービス参照を追加しようとすると、残念ながら、Visual Studioは次の警告を生成します。.NETからGlassFishで生成されたWSDLを使用できません

Custom tool warning: The following Policy Assertions were not Imported: 
    XPath://wsdl:definitions/wsdl:binding[@name='SecurityWebServicePortBinding']/wsdl:operation[@name='RegisterUser'] 
    Assertions: 
    <wsat:ATAlwaysCapability xmlns:wsat='http://schemas.xmlsoap.org/ws/2004/10/wsat'>..</wsat:ATAlwaysCapability> 

どうやらそれはGlassFishサーバーによって公開されたWSDLにポリシーアサーションを理解することはできません。ここではWSDLからの抜粋です:

<?xml version='1.0' encoding='UTF-8'?> 
<definitions 
    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
    xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" 
    xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns:tns="http://test/securityservice.wsdl" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns="http://schemas.xmlsoap.org/wsdl/" 
    targetNamespace="http://test/securityservice.wsdl" 
    name="SecurityService"> 

    <wsp:Policy xmlns:wsat="http://schemas.xmlsoap.org/ws/2004/10/wsat" wsu:Id="SecurityWebServicePortBinding_AuthenticateUser_WSAT_Policy"> 
     <wsat:ATAlwaysCapability /> 
     <wsat:ATAssertion xmlns:ns1="http://schemas.xmlsoap.org/ws/2002/12/policy" wsp:Optional="true" ns1:Optional="true" /> 
    </wsp:Policy> 

    <wsp:Policy xmlns:wsat="http://schemas.xmlsoap.org/ws/2004/10/wsat" wsu:Id="SecurityWebServicePortBinding_RegisterUser_WSAT_Policy"> 
     <wsat:ATAlwaysCapability /> 
     <wsat:ATAssertion xmlns:ns2="http://schemas.xmlsoap.org/ws/2002/12/policy" wsp:Optional="true" ns2:Optional="true" /> 
    </wsp:Policy> 

    ... 

    <binding name="SecurityWebServicePortBinding" type="tns:SecurityWebService"> 
     <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> 
     <operation name="RegisterUser"> 
      <wsp:PolicyReference URI="#SecurityWebServicePortBinding_RegisterUser_WSAT_Policy" /> 
      <soap:operation soapAction="RegisterUser" /> 
      <input> 
       <wsp:PolicyReference URI="#SecurityWebServicePortBinding_RegisterUser_WSAT_Policy" /> 
       <soap:body use="literal" /> 
      </input> 
      <output> 
       <wsp:PolicyReference URI="#SecurityWebServicePortBinding_RegisterUser_WSAT_Policy" /> 
       <soap:body use="literal" /> 
      </output> 
      <fault name="UsernameExistsException"> 
       <soap:fault name="UsernameExistsException" use="literal" /> 
      </fault> 
     </operation> 
    </binding> 

    ... 

</definitions> 

私はWSDLからすべてのポリシー要素を削除すると、Visual Studioは問題なくサービスを利用することができます(実際には、以前の私は手でWSDLを書くために使用され、決してポリシーステートメントを入れる)。だから私の質問は次のとおりです:

  1. なぜ、GlassFishはポリシーの追加を主張していますか?それらを抑制する方法はありますか?
  2. Visual StudioがポリシーでWSDLを使用できないのはなぜですか?
+0

どのようにWSDLを使用していますか? "サービス参照の追加"? –

+0

はい - 「サービス参照の追加」およびWSDLのURLを指しています。 – Naresh

答えて

0

私はGlassFishがws-ATポリシーを追加している理由を理解しました。私のWebサービスが(下記参照)EJBを使用して生成されている:

@Stateless 
@WebService 
public class SecurityWebService { 
    ... 
} 

ステートレスEJBメソッドのデフォルトのトランザクション属性を必要とするため、GlassFishのは、あまりにも(詳細はhereを参照)は、Webサービスメソッドのトランザクションを作っています。私が望む振る舞いではありませんが、それはそれです!

0

ws-AT(Atomic Transactions)は、WCFが知らないSOAP仕様の一部であるようです。 ここにいくつかの情報があります - http://schemas.xmlsoap.org/ws/2004/10/wsat/

更新:(実際にWCFは、WS-AT仕様を認識しているが、完全にそれをサポートしていませんhttp://schemas.xmlsoap.org/ws/2004/10/wsat /)。私はこれがWCFがOleTransactionsを使う代替案を持っているからだと思います。

+0

これを記載したリンクを教えてください。 – kevindaub

+0

ありがとうございます。 ws-ATがこの問題を引き起こしていることがわかったので、GlassFishがws-ATポリシーを発行するのを止める方法はありますか? – Naresh

関連する問題