Skip to main content

Bing and JAX-WS RI

Posted by jitu on July 28, 2009 at 7:25 PM PDT


Bing and JAX-WS

Too bad, wsimport doesn't work out of the box to consume bing's wsdl. It reports conflicts for SearchRequest and SearchResponse.

You could use an unsupported(and undocumented!) wsimport switch -XautoNameResoultion that resolves the conflicts automatically. .

wsimport -B-XautoNameResolution http://api.search.live.net/search.wsdl

See it creates SearchRequest, SearchRequest2, SearchResponse, SearchResponse2 during the resolution

The standard solution is to use a customization file to resolve the conflicts and give some meaningful names. The following custom.xml file provides exactly the same(considering RequestParameters, ResponseParameters are good names !!)

<bindings 
    xmlns="http://java.sun.com/xml/ns/jaxws"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">

    <bindings node="wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='http://schemas.microsoft.com/LiveSearch/2008/03/Search']/xsd:complexType[@name='SearchRequest']">
        <jaxb:class name="RequestParameters"/>
    </bindings>
    <bindings node="wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='http://schemas.microsoft.com/LiveSearch/2008/03/Search']/xsd:complexType[@name='SearchResponse']">
        <jaxb:class name="ResponseParameters"/>
    </bindings>
  
</bindings>

wsimport -b custom.xml http://api.search.live.net/search.wsdl

I couldn't try the search service myself as I need to get AppId!


Related Topics >>