• 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
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Consuming a .NET Typed DataSet from Java

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!

 
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!
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!
 
Imran Akbar
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Catch Ernie! Catch the egg! And catch this tiny ad too:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic