aspose file tools*
The moose likes Web Services and the fly likes Consuming a .NET Typed DataSet from Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Consuming a .NET Typed DataSet from Java " Watch "Consuming a .NET Typed DataSet from Java " New topic
Author

Consuming a .NET Typed DataSet from Java

Imran Akbar
Ranch Hand

Joined: May 06, 2010
Posts: 63
Ranch,

I am developing a client in java for a web service developed on .NET. i am calling a method on the web service which returns a .NET data set, on java it shows the data set returned as a list of Objects.

i used netbeans with METRO 2.0 as stack for generating the client stubs.



any idea, suggestions on how to handle the above will greatly help.

Thanks in advance!

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
It is difficult to give any concrete advice, because you do not say what you want to accomplish.
A general advice is that you probably want to use a JAXB mapping file when creating the client artifacts.
Such a file is supplied to the wsimport command using the -b option.
For more information on JAXB mapping files, see http://download.oracle.com/docs/cd/E17802_01/webservices/webservices/docs/1.5/tutorial/doc/JAXBUsing4.html
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
Imran Akbar
Ranch Hand

Joined: May 06, 2010
Posts: 63
Thnx Krizsan,


i have the following on WSDL, on a method Response "EFT_Client_Result"



with the above i was not able to generate stubs using net beans, so i removed below lines



and appended



i'm not pretty sure the way i did is right, but i was able to generate stubs after changing the WSDL.

as the response element has no schema defined, it has been treated as object.

please let me know do i ask for the Schema for the Response method and bind them with JAXB

Thanks.

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
If you are not the person, or in the company, that has developed the .NET service, then making modifications to the WSDL is not a good idea.

You have an element which can contain two sub-elements. The sub-elements can contain any legal XML fragment.
You get a list of objects in the Java client, which is the way JAXB "translates" the XML schema type any.
What kind of result do you want to obtain in the Java client?
Best wishes!
Imran Akbar
Ranch Hand

Joined: May 06, 2010
Posts: 63

Yes, its not a good idea to edit WSDL. as it was given on a forum and my curiosity forced to do that.

from the API document provided, the list will be like below, this is the output which i'm expecting



i'm referring below links it has something related to my problem.

Link 1

Link2

Link 3
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
I am beginning to get the feeling that modifying the WSDL perhaps isn't that bad an idea after all...
An alternative is to write an endpoint implementation class that implements the javax.xml.ws.Provider interface and is annotated with the @WebServiceProvider annotation. This will allow you to implement the parsing of incoming SOAP messages in Java, instead of having JAXB unmarshal the XML. Yes, it will require more coding and the code will require modifications when the WSDL changes.

If you select the option which includes modifying the WSDL, then what I would try is to create a XML schema that describes the format of the expected data and use that in the WSDL, instead of the any type. I'll give it a try later, if I have some time to spare.
Best wishes!
Imran Akbar
Ranch Hand

Joined: May 06, 2010
Posts: 63
Thanks for your suggestion Ivan,


If you select the option which includes modifying the WSDL, then what I would try is to create a XML schema that describes the format of the expected data and use that in the WSDL, instead of the any type. I'll give it a try later, if I have some time to spare.
Best wishes!


i will try the above approach, and it would be the easier one, once i get the solution i will post it here.

Thanks.
Imran Akbar
Ranch Hand

Joined: May 06, 2010
Posts: 63
Its been a week long trying to achieve the solution, but it failed with several attempts, so i have to back here for a solution from Ranch,

So what i did is created a .NET web service which reads a XML file and return it as a dataset on a helloworld method

here is the WSDL




Here is a response for the HelloWorld method



there is schema generated on run-time, now i have the schema, i need to append the schema into WSDL so when wsimport parse it, it can generate classes with that schema.

so what i did was appended the schema on WSDL like below for the response



i was able to generate classes, but when i run the program it seems the values are not able to bind on the prescribed object, it returns a null pointer exception, on a Soap logging i can see the response was returned successfully but the client was not able to parse it.

all the links for the issues are finished up with no solution

http://forums.java.net/jive/thread.jspa?threadID=23398

http://forums.java.net/jive/message.jspa?messageID=201229

I am sitting with this issue for past 15 days with no solution , Anyone have dealt the above scenario leave a comment.

Thanks in advance
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Consuming a .NET Typed DataSet from Java
 
Similar Threads
Error 500 HELP Hosted Tomcat Server
Axis in WSAD
java client call to https web service behind proxy
Interoperability
setting the endpoint url