WCF专题系列(1):深入WCF寻址Part 1
<S:Envelope xmlns:S="[url]http://www.w3.org/2002/12/soap-envelope[/url]" xmlns:wsa="[url]http://schemas.xmlsoap.org/ws/2003/03/addressing[/url]"> <S:Header> <wsa:ReplyTo> <wsa:Address>[url]http://business456.com/client1[/url]</wsa:Address> </wsa:ReplyTo> <wsa:To>[url]http://fabrikam123.com/Purchasing[/url]</wsa:To> <wsa:Action>[url]http://fabrikam123.com/SubmitPO[/url]</wsa:Action> </S:Header> <S:Body> ...... </S:Body> </S:Envelope>
<wsa:EndpointReference> <wsa:Address>xs:anyURI</wsa:Address> <wsa:ReferenceProperties>... </wsa:ReferenceProperties> ? <wsa:ReferenceParameters>... </wsa:ReferenceParameters> ? <wsa:PortType>xs:QName</wsa:PortType> ? <wsa:ServiceName PortName="xs:NCName"?>xs:QName</wsa:ServiceName> ? <wsa:Policies> ... </wsa:Policies>? <xs:any/>* </wsa:EndpointReference>
<wsa:myLocation> <wsa:Address>[url]http://localhost:8887/CalculatorService</[/url]wsa:Address> </wsa:myLocation>
<wsa:To>xs:anyURI</wsa:To> ? <wsa:From>wsa:EndpointReferenceType</wsa:From> ? <wsa:ReplyTo>wsa:EndpointReferenceType</wsa:ReplyTo> ? <wsa:FaultTo>wsa:EndpointReferenceType</wsa:FaultTo> ? <wsa:Action>xs:anyURI</wsa:Action> <wsa:MessageID>xs:anyURI</wsa:MessageID> ? <wsa:RelatesTo RelationshipType="xs:anyURI"?>xs:anyURI</wsa:RelatesTo> * <wsa:ReferenceParameters>xs:any*</wsa:ReferenceParameters> ?
<wsa:Action>[url]http://tempuri.org/ICalculator/Add[/url]</wsa:Action>
/// <summary> /// Author: TerryLee /// Url:[url]http://www.cnblogs.com/terrylee[/url] /// </summary> [ServiceContract] public interface ICalculator { [OperationContract] int Add(int x, int y); } public class CalculatorService : ICalculator { public int Add(int x, int y) { return x + y; } }
<s:Envelope xmlns:s="[url]http://schemas.xmlsoap.org/soap/envelope/[/url]"> <s:Header> <To s:mustUnderstand="1">[url]http://localhost:8887/CalculatorService[/url]</To> <Action s:mustUnderstand="1">[url]http://tempuri.org/ICalculator/Add[/url]</Action> </s:Header> <s:Body> <Add xmlns="[url]http://tempuri.org/[/url]"> <x>1</x> <y>2</y> </Add> </s:Body> </s:Envelope>
本文出自 “TerryLee技术专栏” 博客,请务必保留此出处http://terrylee.blog.51cto.com/342737/107933
支持LEE的文章,有收获。