2016-03-17 9 views
9

私は自分のプロジェクトにサービスリファレンスを追加しようとしていますが、常に同じエラーが発生しています。サービス参照が読み込まれていません:ターゲット名前空間のスキーマが見つかりませんでした

私は罰金だSOAPのUIを持つモックサービスを作成しました、そして私は、このモックサービスとエラーにサービス参照を追加しようと表示されます。

Warning 14 Custom tool warning: Cannot import wsdl:portType 
Detail: An exception was thrown while running a WSDL import extension:  System.ServiceModel.Description.DataContractSerializerMessageContractImporter 
Error: Schema with target namespace 'urn:oasis:names:tc:dss:1.0:core:schema' could not be found. 
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/esign']/wsdl:portType[@name='EsignServiceSoap11PortType']  

とWSDLどこスキーマのインポート名前空間URN:オアシス:名:TC:DSS:1.0:コア:スキーマがロードされているが、次のとおりです。

<wsdl:types> 

     <schema xmlns="urn:oasis:names:tc:dss:1.0:core:schema"> 

      <import namespace="urn:oasis:names:tc:dss:1.0:core:schema" schemaLocation="oasis-dss-core-schema-v1.0-os.xsd"/> 

     </schema> 

    ..... 
</wsdl:types> 

私はすでにに、WSDLと同じフォルダ内のファイルへの直接のschemaLocationをリンクしようとしましたプライベートサーバーに公開されているURLと公開されている公開URLにアクセスします。

いつも同じエラーが発生し、問題の原因と誤解されている可能性があります。

洞察は非常に高く評価されます。

更新:インポートする代わりに、urn:oasis:names:tc:dss:1.0:core:schema完全定義をwsdlファイル内に挿入しました。

The document was understood, but it could not be processed. 
    - The WSDL document contains links that could not be resolved. 
    - DTD is prohibited in this XML document. 
Metadata contains a reference that cannot be resolved: 'http://elite8100-3:8088/mockEsignServiceSoap11Binding?WSDL'. 
The content type text/html; charset=iso-8859-1 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 455 bytes of the response were: '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> 
    <soap:Body> 
    <soap:Fault> 
     <soap:Code> 
    <soap:Value>Server</soap:Value> 
    </soap:Code> 
    <soap:Reason> 
    <!--1 or more repetitions:--> 
    <soap:Text xml:lang="en">Missing operation for soapAction [null] and body element [null] with SOAP Version [SOAP 1.2]</soap:Text> 
    </soap:Reason> 
</soap:Fault> 
    </soap:Body> 
</soap:Envelope>'. 
The remote server returned an error: (500) Internal Server Error. 
If the service is defined in the current solution, try building the solution and adding the service reference again. 

EDIT2:私は、HTTPをチェックするフィドラーを使用しました、私はそうすると、SOAPのUIは、まだ私はサービス参照を追加しようとすると、このエラーは、サービス検出時にスローされる、しかし、正しくモックサービスを作成しますその答えに示唆されているように、プロキシを作成しようとするときのトラフィック。作成中に、mockService URLに到達しようとしたときにFiddlerに500の内部サーバーエラーが表示され、サーバーからの応答がSOAPバージョン[SOAP 1.2]でsoapAction [null]およびbody要素[null]の操作がありませんでした。

これは現在、mockServiceの作成に使用しているWSDLです。

<wsdl:types> 

     <schema xmlns="http://www.w3.org/2001/XMLSchema"> 

      <import namespace="http://www.w3.org/2001/XMLSchema" schemaLocation="http://aplicaciones.serpasa.es/CONTROLAMBIENTAL/oasis-dss-core-schema-v1.0-os.xsd"/> 

     </schema> 

     <schema xmlns="http://princast.es/esign/2.0/esign.xsd"> 

      <import namespace="http://princast.es/esign/2.0/esign.xsd" schemaLocation="http://aplicaciones.serpasa.es/CONTROLAMBIENTAL/esign.xsd"/> 

     </schema> 

</wsdl:types> 


<wsdl:message name="SignRequestMessage"> 

     <wsdl:part element="dss:SignRequest" name="payload"/> 

</wsdl:message> 

<wsdl:message name="SignResponseMessage"> 

     <wsdl:part element="dss:SignResponse" name="payload"/> 

</wsdl:message> 


<wsdl:message name="VerifyRequestMessage"> 

     <wsdl:part element="dss:VerifyRequest" name="payload"/> 

</wsdl:message> 

<wsdl:message name="VerifyResponseMessage"> 

     <wsdl:part element="dss:VerifyResponse" name="payload"/> 

</wsdl:message> 


<wsdl:message name="GetSignInfoFromDocumentRequestMessage"> 

     <wsdl:part element="esign:SignInfoRequest" name="payload"/> 

</wsdl:message> 

<wsdl:message name="GetSignInfoFromDocumentResponseMessage"> 

     <wsdl:part element="esign:SignInfo" name="payload"/> 

</wsdl:message> 


<wsdl:message name="GetSignConfigurationRequestMessage"> 

     <wsdl:part element="esign:SignConfigurationRequest" name="payload"/> 

</wsdl:message> 

<wsdl:message name="GetSignConfigurationResponseMessage"> 

     <wsdl:part element="esign:SupportedSignConfiguration" name="payload"/> 

</wsdl:message> 


<!-- Port --> 


<wsdl:portType name="EsignServiceSoap11PortType"> 


     <wsdl:operation name="sign"> 

      <wsdl:input message="impl:SignRequestMessage" name="signRequest"/> 

      <wsdl:output message="impl:SignResponseMessage" name="signResponse"/> 

     </wsdl:operation> 


     <wsdl:operation name="verify"> 

      <wsdl:input message="impl:VerifyRequestMessage" name="verifyRequest"/> 

      <wsdl:output message="impl:VerifyResponseMessage" name="verifyResponse"/> 

     </wsdl:operation> 


     <wsdl:operation name="getSignConfiguration"> 

      <wsdl:input message="impl:GetSignConfigurationRequestMessage" name="getSignConfigurationRequest"/> 

      <wsdl:output message="impl:GetSignConfigurationResponseMessage" name="getSignConfigurationResponse"/> 

     </wsdl:operation> 


     <wsdl:operation name="getSignInfoFromDocument"> 

      <wsdl:input message="impl:GetSignInfoFromDocumentRequestMessage" name="getSignInfoFromDocumentRequest"/> 

      <wsdl:output message="impl:GetSignInfoFromDocumentResponseMessage" name="getSignInfoFromDocumentResponse"/> 

     </wsdl:operation> 


</wsdl:portType> 


<!-- Binding --> 

<wsdl:binding name="EsignServiceSoap11Binding" type="impl:EsignServiceSoap11PortType"> 


     <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 


     <wsdl:operation name="sign"> 

      <wsdl:documentation> 

      Realiza una firma digital delegada sobre un 
      documento segun el estandard OASIS Digital Signature Service (DSS) 
      </wsdl:documentation> 


      <wsdlsoap:operation soapAction="urn:sign"/> 

      <wsdl:input name="signRequest"> 

       <wsdlsoap:body use="literal"/> 

      </wsdl:input> 

      <wsdl:output name="signResponse"> 

       <wsdlsoap:body use="literal"/> 

      </wsdl:output> 

     </wsdl:operation> 


     <wsdl:operation name="verify"> 

      <wsdl:documentation> 

      Verifica una firma digital OASIS Digital 
      Signature Service (DSS) 
      </wsdl:documentation> 


      <wsdlsoap:operation soapAction="urn:verify"/> 

      <wsdl:input name="verifyRequest"> 

       <wsdlsoap:body use="literal"/> 

      </wsdl:input> 

      <wsdl:output name="verifyResponse"> 

       <wsdlsoap:body use="literal"/> 

      </wsdl:output> 

     </wsdl:operation> 


     <wsdl:operation name="getSignConfiguration"> 

      <wsdl:documentation> 

      Obtiene los certificados con los que una 
      aplicacion en el MC de Firma Digital puede realizar 
      una firma 
      </wsdl:documentation> 


      <wsdlsoap:operation soapAction="urn:getSignConfiguration"/> 

      <wsdl:input name="getSignConfigurationRequest"> 

       <wsdlsoap:body use="literal"/> 

      </wsdl:input> 

      <wsdl:output name="getSignConfigurationResponse"> 

       <wsdlsoap:body use="literal"/> 

      </wsdl:output> 

     </wsdl:operation> 


     <wsdl:operation name="getSignInfoFromDocument"> 

      <wsdl:documentation> 

      Obtiene informacion de un fichero de firma 
      </wsdl:documentation> 


      <wsdlsoap:operation soapAction="urn:getSignInfoFromDocument"/> 

      <wsdl:input name="getSignInfoFromDocumentRequest"> 

       <wsdlsoap:body use="literal"/> 

      </wsdl:input> 

      <wsdl:output name="getSignInfoFromDocumentResponse"> 

       <wsdlsoap:body use="literal"/> 

      </wsdl:output> 

     </wsdl:operation> 


</wsdl:binding> 


<wsdl:service name="EsignService"> 


     <wsdl:documentation> 

     Servicio web de firma digital 
     </wsdl:documentation> 


     <wsdl:port binding="impl:EsignServiceSoap11Binding" name="EsignServiceSoap11Port"> 


      <wsdlsoap:address location="http://someexternalsite.com"/> 


     </wsdl:port> 


</wsdl:service> 

しかし私は、彼らがこの公開サーバ上のアドレスを指すように、また、私はschemaLocationsを変更した、関連するすべての単一の.xsdをダウンロードし、公開サーバ上に公開しました、この問題はWSDLの構造に関連しているようです。

+0

ペイロードはsoapエンベロープのように見えますが、更新のために、(application/soap + xml; charset = utf-8)ではなく、content typeヘッダーが正しく設定されていないようです。また、サーバーが(500)内部サーバーエラーをスローしています。そのサーバー上のエラーにアクセスできますか? – Dijkgraaf

+0

@Dijkgraafコンテンツタイプのエラーは、スキーマを含めるだけで何の問題もないので、まったく間違っています。残念ながら私はリモートサーバー上のエラーを見るためにアクセスしていません。 – Bardo

+0

簡単な質問ですが、ローカルのテストスキーマに接続しようとしたときに何が起こるのかを確認しようとしましたか?問題のあるスキーマと同じ場所にあるスキーマ根本的な問題は、一般的なスキーマまたはこの特定のスキーマへのアクセスに問題があるかどうかです。私はそれが問題を解決しないことを知っているが、それは問題をローカライズするでしょう – user3569147

答えて

1

更新前の主な問題は、構文が間違っていることです。 <schema xmlns="urn:oasis:names:tc:dss:1.0:core:schema">と言うところでは、このツールは<schema xmlns="http://www.w3.org/2001/XMLSchema">を予期しています。外部のXSDファイルを単純にインポートするには、上記のデフォルトのXML名前空間で必要なだけ修正します。

スキーマのインポート/インクルードはかなり混乱する可能性があります。そのような場合には、WSDLの中に入れておくと、間違いを犯すのは簡単です。カットアンドペーストの単純なケースではないためです。たとえば、いくつかのツールでは、もともとxsd:includeに基づいていた参照を扱う問題があるかもしれません。 chameleon includesはWSDLの内部では再現できません。すべてのxsd:importsはschemaLocation属性を使用してはいけません。

壊れた参照に関連する問題をトラブルシューティングするには、FiddlerなどのHTTPデバッガを使用することを強くお勧めします。少なくとも、あなたが掃除するのを忘れていた参照や、モック解決策が正しく設定していないHTTPヘッダーは教えてくれます。

上記の問題が残っている場合は、変更したWSDLを投稿する必要があります。

+0

完全なWSDLを追加しました。サービスリファレンス中にFiddlerをチェックしたところ、SOAPバージョン[SOAP 1.2] " – Bardo

+0

@BardoのsoapAction [null]およびbody要素[null]の操作がありませんでした。あなたのWSDLを最初の提案に従って修正する必要があります。スキーマ要素の名前空間が 'http:// www.w3.org/2001/XMLSchema'であることを確認してください。 –

+0

私もそれをしましたが、何も変更しませんでした。同じエラー。質問のコードスニペットの変更を反映しました。 – Bardo

関連する問題