入力パラメータも出力パラメータもない操作が 1 つしかない WSDL を手動で作成しました。
この WSDL からクライアントを作成しようとすると、次のエラーが発生します。
wsdl:portType 詳細をインポートできません: WSDL インポート拡張機能の実行中に例外がスローされました: System.ServiceModel.Description.DataContractSerializerMessageContractImporter エラー: ターゲット名前空間のスキーマ ' http://www.xmlns.mycompany.com/GAME/service/Associate/ 1.1/ ' が見つかりませんでした。エラー ソースへの XPath: //wsdl:definitions[@targetNamespace=' http://www.xmlns.mycompany.com/GAME/service/Associate/1.1/ ']/wsdl:portType[@name='GAMEAssociateIntf'] C :\toolbox\BlueTest\BloodRedTest\BloodRedTest\Service
(types
クライアントで使用される) は、WSDL に存在する XML から生成する必要があります。サービス参照を追加しているときに、XML のエラーが原因でツールが作成に失敗していると思います。xsdが問題のようです。
プロキシを作成するには、WSDL でどのような変更を行う必要がありますか?
注: WSDL 自体で定義されている xml タイプを含めようとしています。【スキーマ定義用の別ファイルはいらない】
WSDL
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="GAMEAssociate"
targetNamespace="http://www.xmlns.mycompany.com/GAME/service/Associate/1.1/"
xmlns:tns="http://www.xmlns.mycompany.com/GAME/service/Associate/1.1/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsp="http://www.w3.org/ns/ws-policy"
>
<types>
<xsd:schema>
</xsd:schema>
<xsd:element name="myData">
<xsd:complexType />
</xsd:element>
<xsd:element name="myDataResponse">
<xsd:complexType />
</xsd:element>
</types>
<message name="getAllVicePresidentsRequest">
<part element="tns:myData" name="getAllVicePresidentsRequest"/>
</message>
<message name="getAllVicePresidentsResponse">
<part element="tns:myDataResponse" name="getAllVicePresidentsResponse"/>
</message>
<portType name="GAMEAssociateIntf">
<operation name="getAllVicePresidents">
<input message="tns:getAllVicePresidentsRequest"/>
<output message="tns:getAllVicePresidentsResponse"/>
</operation>
</portType>
<binding name="GAMEAssociateIntfBinding" type="tns:GAMEAssociateIntf">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getAllVicePresidents">
<soap:operation soapAction="http://www.xmlns.mycompany.com/GAME/wsdl/AssociateIntf/1.4/getAllVicePresidentsRequest"
style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="GAMEAssociate">
<port binding="tns:GAMEAssociateIntfBinding" name="GAMEAssociateSOAP">
<soap:address location="http://localhost:8014/associateservice/GAMEAssociate.svc"/>
</port>
</service>
</definitions>
参考文献: