开发者

Get WCF to recognise incoming SOAP request

I'm trying to write a C# app to receive eBay notifications which are sent as SOAP over HTTP. I am receiving the notifications OK but I can't get them passed to my WCF service. What do I need to do on the WCF service configuration to allow the incoming SOAP request to be recognised? I'm using a webHttpBinding with the WCF service.

The SOAP request is:

POST /paypal/ebaynotification.svc HTTP/1.0
Host: myserver.com
Content-Type: text/xml;charset=utf-8
SOAPAction: "http://developer.ebay.com/notification/ItemListed"
Content-Length: 6610
X-Original-Client: 10.71.29.83
Via: 1.0 sjcproxy10b:8081 (squid)
Cache-Control: max-age=86400
Connection: keep-alive

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmln开发者_如何学JAVAs:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Header>
  <ebl:RequesterCredentials soapenv:mustUnderstand="0" xmlns:ns="urn:ebay:apis:eBLBaseComponents" xmlns:ebl="urn:ebay:apis:eBLBaseComponents">
   <ebl:NotificationSignature xmlns:ebl="urn:ebay:apis:eBLBaseComponents">RnvpyFAXc9Duo0W+/Mk68g==</ebl:NotificationSignature>
  </ebl:RequesterCredentials>
 </soapenv:Header>
 <soapenv:Body>
      ....
     </soapenv:Body>
   </soapenv:Envelope>

My WCF service interface is:

[ServiceContract(Namespace="http://developer.ebay.com/notification")]
public interface Iebaynotification
{
    [OperationContract]
    void ItemListed(ItemType item);
}


You need something to "catch" that incoming SOAP request and spin up the WCF class to handle it.

You can either have a self-hosted WCF service (e.g. inside a Windows NT Service) listening on a given endpoint URL, or you can have a message-based activation, like IIS/WAS that will catch an incoming message and pass it to WCF for handling.

So basically, you need to implement that service contract in a WCF service class, and then you need to host / deploy that WCF service in such a way that the incoming message will be handled by it.

But most importantly: since it's a SOAP message, you cannot use webHttpBinding which is the binding used for WCF REST services. You will need to use something like basicHttpBinding or wsHttpBinding.


If eBay exposes a SOAP endpoint, I would guess that they've have a publicized a WSDL document describing the callback service. You can use the svcutil.exe command line tool to generate a correct WCF contract(s) / C# interface that you need to implement in your service implementation to handle the SOAP message you're describing. See eBay's API documentation...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜