0
我已經從編寫的RPC PHP服務返回的SOAP信封,我編寫了這個服務,它在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: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>
變成這樣:
<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>
WSDL中是否有某些內容可以更改以強制該名稱空間進入有效內容?我嘗試將它移動到幾個不同的地方無濟於事。謝謝你的幫助。
PS如果你發現WSDl有問題,只要它沒有被驗證或類似的東西,只要忽略它...原始驗證/部署/工作正常。我更擔心我可以放置名稱空間的位置。謝謝!
這也是我最初的想法。所以,也許我問的是錯誤的問題。此服務的響應正在被使用代理的WCF客戶端使用。肥皂信封與上面的第一個示例類似,但代理完成後值會顯示爲false。所以,我認爲代理正在將有效載荷從soap包中剝離出來,因此ns1將不再擁有一個聲明的名稱空間。我吠叫錯了樹嗎?有沒有其他原因呢? – 2009-07-15 20:35:00