views:

627

answers:

1

I'm trying to make my first web service client for the eBay API using the NetBeans 'new Web Service Client' wizard and the WSDL found here. My understanding is that this is using JAX-WS to generate class files, and my requests are all SOAP.

Everything seems to work fine except when I try to execute a request, eBay responds with a 404 which seems to be its standard response if the call made no sense to it.

Wireshark shows my request as:

<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"&gt;
<S:Body>
<FindItemsRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<QueryKeywords>dvd players</QueryKeywords>
</FindItemsRequest></S:Body></S:Envelope>

But the eBay API test tool say it should look like:

<?xml version="1.0" encoding="utf-8"?>
<FindItems xmlns="urn:ebay:apis:eBLBaseComponents">
<QueryKeywords>dvd players</QueryKeywords>
</FindItems>

So NetBeans has wrapped my request with what I can only assume is some standard SOAP structure, and appends 'Request' to the name of the call.

Where does it get this 'envelope' namespace from and why doesn't eBay use it? And how can I tell NetBeans what I really want it to do?

I'm also wondering what the benefit is to the eBay SDK over this method (if it worked).

A: 

I managed to figure it out and as usual I'm kicking myself for not reading the API docs thoroughly.

The eBay API expects certain HTTP headers to be set before it gives anything other than a 404.

After that, the SOAP request NetBeans came up with was interpreted correctly by eBay and the expected results returned.

eBay shopping API HTTP header values

JAX-WS user guide - setting HTTP headers

Cogsy