aspose file tools*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes Query regarding RPC/Document Style,WSGEN and WSIMPORT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "Query regarding RPC/Document Style,WSGEN and WSIMPORT" Watch "Query regarding RPC/Document Style,WSGEN and WSIMPORT" New topic
Author

Query regarding RPC/Document Style,WSGEN and WSIMPORT

Jolly Tiwari
Ranch Hand

Joined: Mar 26, 2006
Posts: 77
Hi! everybody,

I have a query regarding the style attribute in the binding element in WSDL.
I created a SOAP based service using both RPC style and DOCUMENT style one by one.

FINDINGS

1.After executing wsgen on Implementation class in both the cases i found that no source or class file was created in case of RPC style.


2.in case of Document style , i found two source and class files corresponding to the function name,like getDateAsString and getDateAsStringResponse.

3.after executing wsimport ,in case of document style ,i found again two classes(getDateAsString and getDateAsStringResponse.
) along with proxy classes.

DOUBTS

1.when and why are these classes (getDateAsString and getDateAsStringResponse) required?

2.I was able to run this soap based document style web service without running wsgen and wsimport through a POJO java client code.In that case how and when are these two mentioned classes (getDateAsString and getDateAsStringResponse) created?

3. After invoking without any proxy and associated classes i tried after running wsimport and using those generated classes.it was successfull.but again i found that these two classes (getDateAsString and getDateAsStringResponse)were created.so why should we run wsgen when we can get the same classes generated through wsimport?


I request all here to explain the requirement of all this in simple words as i have went through many documents which use heavy words like translation of java types to XML and such stuff but I am not able to get it.

Thanks in advance

Regards

Jolly
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
How about letting us have a look at the WSDL you use?
You can, for instance, comment the parts that differ for RPC and Document style.
Jolly Tiwari
Ranch Hand

Joined: Mar 26, 2006
Posts: 77
I am sharing WSDL's in both the cases i.e RPC and DOCUMENT style respectively





**********************




for schemaLocation="http://127.0.0.1:9876/testdoc?xsd=1"


This all i am able to see after executing my simple piece of code and then putting http://127.0.0.1:9876/testdoc?WSDL in the browser:



Regards

Jolly
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Here are some quick attempts at answers, for the time being:
1. With Document style services, the contents of the SOAP body is a custom XML fragment that can be validated.
JAX-WS, using the JAXB XML schema compiler, generates JAXB bean classes aiding in binding XML data to a tree of Java objects. In this case, the tree representing a request and a response is just one single object.
When using RPC, no such JAXB classes are needed, since you only use simple type (string) parameters and return data in your methods.
In the case of RPC, the root of the XML element in the SOAP body typically is an element with the same name as the web service operation (method) invoked. This is not described in any XML schema, but is a convention for RPC.
2. Strictly speaking, the JAXB bean classes need not to be created, since SOAP messages can be assembled using, for instance SAAJ.
They may be created at runtime.
3. This is the part which I want to investigate a little more.
Basically, wsgen and wsimport creates artifacts for server respective client side. The JAXB bean classes are identical on both sides.
Best wishes!
Jolly Tiwari
Ranch Hand

Joined: Mar 26, 2006
Posts: 77
When using RPC, no such JAXB classes are needed, since you only use simple type (string) parameters and return data in your methods.


What i understood from this statement is that we can work with only built in types in XML schema as request parameters and return types.
In case my method receives a user defined data type (like a Address class created by the developer) I can't go for RPC style and document style is the only option left.


Regards

Jolly
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
What i understood from this statement is that we can work with only built in types in XML schema as request parameters and return types.
In case my method receives a user defined data type (like a Address class created by the developer) I can't go for RPC style and document style is the only option left.

It is dead-simple to try if your statement is true or not - Create a RPC style web service that receives an user-defined data type.
I can reveal the answer right now: You can still use RPC style with user-defined data types. JAXB classes will be generated and used, as needed.
Best regards!
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
I just want to correct a statement I made earlier:
Basically, wsgen and wsimport creates artifacts for server respective client side.

This is not true.
wsgen generates portable artifacts for both client and server side from an annotated web service endpoint implementation class.
wsimport generates portable artifacts from a WSDL file.
Sorry about the error.
Abayomi Osamiluyi
Greenhorn

Joined: Mar 22, 2011
Posts: 2
am finding it difficult to create a client for a web service created in coldfusion. I know the language in which the web service was implemented doesnt really matter.

Can anyone please show me the steps of creating the client from how to generate the artifacts using wsimport to using the artifacts to communicate with the service.

Thank you in anticipation.....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Query regarding RPC/Document Style,WSGEN and WSIMPORT