Win a copy of Getting started with Java on the Raspberry Pi this week in the Raspberry Pi forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Liutauras Vilda
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Piet Souris

Query Regarding WSIMPORT generated Artifacts

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi! Everyone,

I have a query regarding the Artifacts (especially the Port class) generated by wsimport.
I took following two documents :
1. StringProcessorService.wsdl
2. StringProcessorService_Payload.xsd

Reference: snippets taken from IVAN's guide

I Placed both the documents in a directory and then executed wsimport on my command prompt:

c:\wsdl\>wsimport -p clientside -s . StringProcessorService.wsdl


StringProcessorService.wsdl




StringProcessorService_Payload.xsd



Doubt:
When I am looking at the code generated inside the Port class(StringProcessorPort.java) I found following

public ReverseStringResponse reverseString(
@WebParam(name = "reverseStringReq", targetNamespace = "http://www.instinct.com/stringprocessor", partName = "parameters")
ReverseStringRequest parameters);

The parameters and return type are of ReverseStringRequest and ReverseStringResponse respectively.
I guess the wsdl and xsd tells that they should be of String type.

Please correct me if i am wrong.

Regards

Jolly
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

Jolly Tiwari wrote:
The parameters and return type are of ReverseStringRequest and ReverseStringResponse respectively.
I guess the wsdl and xsd tells that they should be of String type.


No, the WSDL does not say that they are of the type String, however, both the request and response objects do contain one string. How can you tell? Well, look at the <portType> element of the WSDL. I have added some comments.


Next, we take a look at the XML schema that defines the reverseStringReq and reverseStringRes elements:


It declares two datatypes, one for the request and one for the response, that both contains a single string each. If we look at the request, then the <inString> element that will contain the string indata of the request will be contained in a <reverseStringReq> element - the name of the complex type of the element in the request message.
Hope this makes things more clear!
 
Jolly Tiwari
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ivan for your quick response

Well that means one of the class generated by wsimport,StringProcessorPort is fine.

public ReverseStringResponse reverseString(
@WebParam(name = "reverseStringReq", targetNamespace = "http://www.instinct.com/stringprocessor", partName = "parameters")
ReverseStringRequest parameters);



To invoke this service operation through Proxy mechanism , We will have to create an instance of JAXB mapping class for Request data and then call its setter method to provide input data which is a String in this case.



Query
What changes need to be done to enable the client to invoke service operation as follows

StringProcessorService srvc=new StringProcessorService();
StringProcessorPort port=srvc.getStringProcessorPort();
String res=port.reverseString("Hello");




Please correct me wherever you feel i am wrong as that would be of great help.

Regards

Jolly
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

Jolly Tiwari wrote:
Query
What changes need to be done to enable the client to invoke service operation as follows



You would need to modify the WSDL or write the proxy classes by hand.
The main point with this example in my study notes is to show how a web service that consumes entire protocol messages, such as SOAP messages or XML messages. This is something that is more likely to be used when developing a document-based web service (as opposed to a RPC web service). If you are implementing a web service endpoint class that implements the Provider interface, you are not very likely to have simple types as parameters.
Best wishes!
 
What a show! What atmosphere! What fun! What a tiny ad!
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
reply
    Bookmark Topic Watch Topic
  • New Topic