Consuming .NET web service with Java Soap Client?

I am looking for an easy way to create a soap request in order to use the .NET web service, but I have not found any documentation on this subject at all. The default javax.xml.soap library is more than ambiguous on how to build a request.

Are there accessible libraries that make my life easier?

I found this piece of code somewhere, and now I don’t use it or which library, but I would really like something like that, instead of manually creating the whole XML message using the DOM or something like that (because it accepts Simple from SOAP)

SoapRequestBuilder s = new SoapRequestBuilder();
s.Server = "127.0.0.1"; // server ip address or name

s.MethodName = "ConcatWithSpace";
s.XmlNamespace = "http://tempuri.org/";
s.WebServicePath = "/SimpleService/Service1.asmx";
s.SoapAction = s.XmlNamespace+s.MethodName;
s.AddParameter("one", "David");
s.AddParameter("two", "Hobbs");
String response = s.sendRequest();

This is the message form I should send:

POST /webservice/TimrService.asmx HTTP/1.1
Host: not.important.host
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetTimetableForBachelorYear"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetTimetableForBachelorYear xmlns="http://tempuri.org/">
      <year>I1</year>
      <halfYear>A</halfYear>
    </GetTimetableForBachelorYear>
  </soap:Body>
</soap:Envelope>
+3
source share
2 answers

.NET, Java, , , wsdl2java SOAPUI. , : http://cxf.apache.org/docs/wsdl-to-java.html. , - .NET , SOAP. .

+3

All Articles