2009-07-15 9 views
1

RPCエンコードされたPHP Webサービスがあり、ブール型のデータ型を持つ単純なSOAPエンベロープを返します。クライアント側のトレースを行う場合、それはWCFプロキシに入る前に、SOAPエンベロープは、この右のようになります。WCFクライアントプロキシが誤ってSOAPエンベロープを返す

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:ns1="http://sample.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org 
/soap/encoding/"> 
    <SOAP-ENV:Body> 
    <ns1:ServiceMessageResponse> 
     <outgoingVar1>true</outgoingVar1> 
    </ns1:ServiceMessageResponse> 
    </SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 

返される値は、プロキシの反対側から出てくるときしかし、それがfalseに変更されています。私はxsi:type = "xsd:boolean"をoutgoingVar1に追加しようとしましたが、それは役に立ちません。石鹸の封筒自体は、クライアントが期待していたはずのものですが、何らかの理由でそれを正しく消費しません。これはPHP Webサービスの設定やWCFプロキシの設定と関係がありますか? PHPのWebサービスは、単純にこのように設定されています

ini_set('soap.wsdl_cache_enabled', '0'); 
ini_set('soap.wsdl_cache_ttl', '0'); 
$soapServer = new SoapServer('wsdl/sample.wsdl', array('soap_version' => SOAP_1_1)); 
$soapServer->addFunction('Service'); 
$soapServer->handle(); 

と機能はシンプルで終わる「trueを返します;」ライン。ここでは何も複雑ではありません。どのような問題がありますか?

注釈付きのWSDL(些細な名前空間を削除し、実際のものを修正)は次のようになります。

<wsdl:definitions name="IJLSoapResponse" targetNamespace="http://casey.com" 
tns="http://casey.com" xmlns:samp="http://sample.com" ...> 
    <wsdl:types> 
    <xsd:schema targetNamespace="http://casey.com" ...> 
      <xsd:element name="incomingVar1" type="xsd:string" nillable="true"/> 
      <xsd:element name="incomingVar2" type="xsd:string" nillable="true"/> 
    </xsd:schema> 
    <xsd:schema targetNamespace="http://sample.com" ...> 
      <xsd:element name="outgoingVar1" type="xsd:boolean" nillable="true"/> 
    </xsd:schema> 
    </wsdl:types> 
    <wsdl:message name="ServiceInput"> 
    <wsdl:part name="incomingVar1" element="tns:incomingVar1"/> 
    <wsdl:part name="incomingVar2" element="tns:incomingVar2"/> 
    </wsdl:message> 
    <wsdl:message name="ServiceOutput"> 
    <wsdl:part name="outgoingVar1" element="samp:outgoingVar1"/> 
    </wsdl:message> 
    <wsdl:portType name="ServicePortType"> 
    <wsdl:operation name="ServiceMessage" parameterOrder="incomingVar1 incomingVar2"> 
      <wsdl:input name="ServiceMessageRequest" message="tns:ServiceInput"/> 
      <wsdl:output name="ServiceMessageResponse" message="tns:ServiceOutput"/> 
    </wsdl:operation> 
    </wsdl:portType> 
    <wsdl:binding name="ServiceBinding" type="tns:ServicePortType"> 
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> 
    <wsdl:operation name="ServiceMessage"> 
      <soap:operation soapAction="http://casey.com/soap/Service"/> 
      <wsdl:input name="ServiceMessageRequest"> 
        <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://casey.com"/> 
      </wsdl:input> 
      <wsdl:output name="ServiceMessageResponse"> 
        <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://sample.com"/> 
      </wsdl:output> 
    </wsdl:operation> 
    </wsdl:binding> 
    <wsdl:service name="ServiceService"> 
    <wsdl:port name="ServicePort" binding="tns:ServiceBinding"> 
      <soap:address location="http://casey.com/soap/Service"/> 
    </wsdl:port> 
    </wsdl:service> 
</wsdl:definitions> 

これは、あなたが明確に何かが必要な場合は私に知らせて...物事が宣言されているかを確認するために十分でなければなりません。ご協力いただきありがとうございます!

+0

WCF側の契約はどうですか? – tomasr

+0

@caseycrites:ここで2と2をまとめるには、WCFコードの一部を参照する必要があります。私はこれをいくつかの他の人に伝えます。 – RSolberg

+0

WCF契約はパートナーのコードなので、私はそれを手に入れることはできないと思います。申し訳ありません... –

答えて

0

ソリューションは、名前空間を扱うことになりました。彼らは正しく伝搬していないので、私はスキーマにelementFormDefault = "qualified"という属性を追加する必要がありました。これは、プレフィックスがすべての要素に存在するように強制します。これは.NETを幸せにする唯一の方法です。あなたのお手伝いをありがとう。

0

サービスのWSDLが表示されますか?私は、名前空間outgoingVar1が何のために意図されているのだろうかと思っています。

RPCエンコードされたサービスは、名前空間のメッセージ部分が何であるかについてのあいまいさのために常に痛いです。ここの問題。


次のバインディングはsoapUIで機能するようです。少なくとも、それはモックサービスを生成することができ、および応答メッセージは、(サンプルの名前空間にoutgoingVar1)を探していたものを次のようになります。

<wsdl:binding name="ServiceBinding" type="tns:ServicePortType"> 
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> 
    <wsdl:operation name="ServiceMessage"> 
     <soap:operation soapAction="http://casey.com/soap/Service"/> 
     <wsdl:input name="ServiceMessageRequest"> 
      <soap:body parts="incomingVar1 incomingVar2" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://casey.com"/> 
     </wsdl:input> 
     <wsdl:output name="ServiceMessageResponse"> 
      <soap:body parts="outgoingVar1" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://sample.com"/> 
     </wsdl:output> 
    </wsdl:operation> 
</wsdl:binding> 
+0

outgoingVar1は、http://sample.com...の一部でなければなりません.nap1(http://sample.com)はServiceResponseの子に伝播してはいけませんか? –

+0

いいえ名前空間はそれほど伝搬しません。これを行うには、xmlns = "http://sample.com"とする必要があります(sample.comをデフォルトの名前空間にします)。 ns1は、それが使用されている要素にのみ適用されます。 –

+0

私はXMLSpyとsoapUIを使ってWSDLで少し演奏しました。 soapUIはそれを好きではありません。入力と出力の名前をportTypeとバインディングの間で一致させたいと思うようです。 –

関連する問題