• Post Reply Bookmark Topic Watch Topic
  • New Topic

Which Java SOAP library for .NET access?

 
Paul Jenkins
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings,
I have a number of .NET developed web services that I want to consume with a Java client. I'm looking for what people consider the 'best' SOAP library for this purpose. I originally tried a small company's product called GLUE, but it wouldn't generate Java files from my .NET WSDL (which is WSDL 1.1 compliant..) when my web service returned a .NET DataSet (which many of my .NET web services do...) They claim that they don't handle WSDL that have "<any>" sequences.
Any advice?
Thanks,
Paul
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose you could just define your client as getting a DOM Element and extract the contents by manipulating that element.
Bill
 
Paul Jenkins
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
true, but that is a load of work. I'd like for the WSDL to properly generate a Java stub class. GLUE does this for simple return types, but fails on complex ones unfortunately...
Sucks..
 
Badal Kotecha
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi paul !
check out the following sample code
I hope this helps u ..
I m using apache soap 2.2 implementation
and my webservice for adding numbers is written in VB.NET
import java.io.*;
import java.net.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import org.apache.soap.*;
import org.apache.soap.messaging.*;
import org.apache.soap.transport.*;
import org.apache.soap.util.xml.*;
import javax.mail.*;
/**
* This class sends a message by taking in an XML file that has a full
* SOAP envelope in it and dumping it to the given message router URL.
* Any content from the response is dumped to stdout.
*
* @author Sanjiva Weerawarana <sanjiva@watson.ibm.com>
*/
public class AddNumbersClient {
public static void main (String[] args) throws Exception {
// get the envelope to send
FileReader fr = new FileReader ("AddNumbers.xml");
DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
Document doc = xdb.parse (new InputSource (fr));
if (doc == null) {
throw new SOAPException (Constants.FAULT_CODE_CLIENT, "parsing error");
}
Envelope msgEnv = Envelope.unmarshall (doc.getDocumentElement ());
// send the message
org.apache.soap.messaging.Message msg = new org.apache.soap.messaging.Message ();
msg.send (new URL ("http://localhost/AddNumbers/AddNumbers.asmx"), "http://tempuri.org/AddNumbers", msgEnv);
// receive whatever from the transport and dump it to the screen
System.out.println ("RESPONSE:");
System.out.println ("--------");
SOAPTransport st = msg.getSOAPTransport ();
BufferedReader br = st.receive ();
String line;
while ((line = br.readLine ()) != null) {
System.out.println (line);
}
}
}

And hers is the soap message... (this is hardcoded... u can generate it dynamically)
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<s:Body>
<AddNumbers xmlns="http://tempuri.org/">
<i>40</i>
<j>70</j>
</AddNumbers>
</s:Body>
</s:Envelope>
Cheers
Badal
www.necoinfotech.com
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!