2009-07-15 12 views
0

SOAPエンベロープのルートノードに名前空間を宣言したコード化RPC PHPサービスから返されるSOAPエンベロープがあります。しかし、私はその名前空間がSOAP本体のxmlペイロードのルートノードに存在することを望んでいます。それが今立っているようSOAPエンベロープルートからXMLペイロードに名前空間を移動

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 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> 
    <ServiceResponse xmlns="http://sample.com"> 
     <outgoingVar1>true</outgoingVar1> 
    </ServiceResponse> 
    </SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 

、ここでは私の注釈が付けられている(些細な名前空間宣言を出し、左)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="ServiceRequest"> 
      <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://casey.com"/> 
     </wsdl:input> 
     <wsdl:output name="ServiceResponse"> 
      <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> 

<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:ServiceResponse> 
     <outgoingVar1>true</outgoingVar1> 
    </ns1:ServiceResponse> 
    </SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 

これになるために:基本的に、私はこれが欲しいですその名前空間をペイロードに強制するために変更できるWSDLには何かがありますか?私はそれをいくつかの別の場所に移動させようとしました。ご協力いただきありがとうございます。

PS検証していない限り、WSDlに何か問題があると思われる場合は、無視してください。元の検証/配布/正常に機能します。名前空間をどこに置くことができるか心配です。ありがとう!

答えて

0

SOAPメッセージを消費するコードが何か問題を起こしていない限り、名前空間が宣言されている場所は関係ありません。

"before"と "after"の両方の例が機能的に同等であるため、両方ともWSDLに関して正しいので、WSDLを変更してもこの点で影響はありません。

+0

これも私の元々の考えでした。だから、私は間違った質問をしているかもしれない。このサービスの応答は、プロキシを使用するWCFクライアントによって消費されています。上記の最初の例のように、soapエンベロープには真の値が入りますが、プロキシでそれを行ったときに値がfalseになります。だから、私はプロキシが石鹸の封筒からペイロードをはがしていると考えていたので、ns1はもはや宣言された名前空間を持たないでしょう。私は間違った木を吠えますか?これには別の理由がありますか? –

+0

私はWCFに慣れていないので私を傷つける:)しかし、プロキシがあなたが何を記述すれば、それはバグです。 – ykaganovich

+0

ご協力いただきありがとうございます。私はWCFプロキシの質問として私のコメントを再投稿します。 –