• Post Reply Bookmark Topic Watch Topic
  • New Topic

Web service method with no parameters  RSS feed

 
Kevin G Scott
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am hoping to get some ideas from some of the Web Services gurus on here. My scenario is that I am designing a Web Service which contains a method with no parameters. I would like to write the WSDL in such a way that's it's clear that no data is required. However, the best way I have thought of to accomplish this is something like:

<xsd:complexType name="getMethod">
<xsd:sequence/>
</xsd:complexType>

<xsd:element name="request" type="ns1:getMethod" />

However, when I generate a client for this using JAX-RPC, it generates the method in the proxy as getMethod(String str) where string is basically useless. My question is, is there a better way to specify a method that does not require any input, or am I stuck with just telling clients to feed junk into the string parameter?

Thanks for any feedback,
KS
 
Tim West
Ranch Hand
Posts: 539
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've not tried to do an empty request, but an empty response can be achieved by having no "parts" in the <message> declaration, viz:



If I were you, I'd try this on the message used for the request.

Note that ultimately the form of the Java interface (and hence number of paramters in a Java sense) is dependent upon two things (1) the WSDL content, and (2) how the Java - WSDL mapping tool (Axis, JWSDP, Weblogic wsdl2service etc) interprets the WSDL. So, although you can control (1), it may be difficult to ensure a particular interpretation (that is, producing a method with no parameters) among all the different mapping tools.


-Tim
 
Esa Paakkanen
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kevin G Scott:

<xsd:complexType name="getMethod">
<xsd:sequence/>
</xsd:complexType>

<xsd:element name="request" type="ns1:getMethod" />

How about this:

<element name="request">
<complexType name="dummyName"></complexType>
</element>
 
Kevin G Scott
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tim West:
I've not tried to do an empty request, but an empty response can be achieved by having no "parts" in the <message> declaration, viz:



If I were you, I'd try this on the message used for the request.

Note that ultimately the form of the Java interface (and hence number of paramters in a Java sense) is dependent upon two things (1) the WSDL content, and (2) how the Java - WSDL mapping tool (Axis, JWSDP, Weblogic wsdl2service etc) interprets the WSDL. So, although you can control (1), it may be difficult to ensure a particular interpretation (that is, producing a method with no parameters) among all the different mapping tools.


-Tim


Tim,
Thanks for your response. This is an interesting idea, but I would be very concerned about the tool support. I think I tried this once and got an error, but I need to try again.

Thanks,
KS
 
Tim West
Ranch Hand
Posts: 539
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, it's legal according to WSDL 1.1, and it's worked for me in Weblogic 8.1.

Good luck though ...and compatibility across different toolkits is still a bit of a pain, hey?


-Tim
 
Kevin G Scott
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tim West:
Hmm, it's legal according to WSDL 1.1, and it's worked for me in Weblogic 8.1.

Good luck though ...and compatibility across different toolkits is still a bit of a pain, hey?


-Tim


Just for the sake of information sharing, I tried this again using the Oracle JDeveloper 10.1.3 Preview (the only edition that supports JAX-RPC) and the wscompile tool in JWSDP 1.5, and neither seems to support this. The wcompile tool returns the following error

"error: parts "parameters" not found in the message "TestWebService1SEI_getTest",wrong WSDL"

Thanks again for the feedback,
KS
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!