Java Reference
In-Depth Information
-extension switch, runtime will try to dispatch using SOAPAction
line 70 of http://localhost:8080/CatalogService/Catalog?wsdl
Follow the advice in the error message and see if that helps. Set your wsimport task attribute
extension to true, and rebuild. This allows you to perform the import, so you get farther along:
Testcase: searchByAuthorTest(com.soacookbook.catalog.test.CatalogTest):
Caused an ERROR
Cannot find dispatch method for Request=[SOAPAction="",
Payload={http://ns.soacookbook.com/catalog}author]
javax.xml.ws.soap.SOAPFaultException: Cannot find dispatch method
for Request=[SOAPAction="",Payload={http://ns.soacookbook.com/
catalog}author]
So making this work requires setting the SOAPAction header. This header is optional in JAX-
WS implementations, and it can only be used if HTTP is your transport layer, which defeats
the purpose of specifying bare in the first place. While it gives you a sense of very loose coup-
ling, which is certainly a goal, if you plan to perform CRUD operations or make your inten-
tions explicit, bare becomes a tricky choice.
Of course, there is a clever workaround for this. If the only requirement keeping you from
having both of your operations accept a single Author parameter is that each element must be
represented by a different element in the schema, you could simply define a second element
with a different name that happens to be of the exact same type:
<xs:schema xmlns:tns="http://ns.soacookbook.com/catalog" ...>
<xs:element name="searchAuthor" nillable="true"
type="tns:Author"></xs:element>
<xs:element name="addAuthor" nillable="true"
type="tns:Author"></xs:element>
<xs:complexType name="Author">
<xs:sequence>
<xs:element name="firstName" type="xs:string"></xs:element>
...
</xs:sequence>
</xs:complexType>
In my view, this is a hack, and I don't recommend doing it. But there it is nonetheless.
I sort of like the theoretical purity that the bare style affords, and I wouldn't necessarily rule it
out entirely. But wrapped is probably going to get you better mileage in the long run.
A document/literal bare WSDL looks like this:
<message name="authorSearch">
<part xmlns:ns4="http://ns.soacookbook.com/catalog" name="author"
Search WWH ::




Custom Search