• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Query Regarding WSIMPORT generated Artifacts

 
Jolly Tiwari
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • 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
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic