tags:

views:

59

answers:

2

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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
 <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);
}
+2  A: 

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.

marc_s
BasicHttp or Custom binding with HTTP transport and text message encoding with message version set to SOAP 1.1 is needed. It will not work with WSHttpBinding.
Ladislav Mrnka
A: 

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...

larsw
eBay do have a SOAP endpoint and even a sample SDK to connect with it so I've no problems there. My issue is the reverse getting a WCF SOAP endpoint to accept a request from eBay's end.
sipwiz
I assume that eBay has provided a WSDL for the callback service in their SDK - have you looked for it and tried to create a WCF contract with svcutil.exe ?
larsw
Yes I have looked for it and no it's not there. If it was I wouldn't have needed to post this question.
sipwiz
This link seems to be a good start: http://developer.ebay.com/DevZone/XML/docs/WebHelp/WorkingWithNotifications-Receiving_Platform_Notifications.html It may be that you can reuse some of the types defined in eBaySvc.wsdl which is found in the eBay .NET SDK combined with creating operation/message/data contracts manually based on the content in the article above.
larsw