2012-05-24 4 views
3

.NET 웹 서비스를 사용하기 위해 비누 요청을 구성하는 간단한 방법을 찾고 있지만이 주제와 관련하여 전혀 설명서가 거의 없습니다. 기본 라이브러리 javax.xml.soap은 요청 구성 방법이 모호합니다.Java SOAP 클라이언트에서 .NET 웹 서비스 사용?

내 인생을 더 편리하게 할 수있는 라이브러리가 있습니까?

이 코드는 어딘가에 있으며 현재 사용 된 라이브러리 나 라이브러리가 아닌 DOM을 사용하여 전체 XML 메시지를 수동으로 생성하는 대신 비슷하게 사용합니다. (이것은 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(); 

이 내가 보내야 할 메시지의 형태이다 : 나는 .NET 개발자에게 자신을 해요

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

,하지만 우리는 제 3 자가 우리 서비스 중 하나를 사용하는 자바 개발자 팀과의 통합 종종 wsdl2java이라는 코드 생성 도구와 SOAPUI이라는 테스트 인터페이스를 참조하십시오. 나는 다음과 같이 생각할 것입니다 : http://cxf.apache.org/docs/wsdl-to-java.html. 올바르게 이해한다면 .NET에서 모든 SOAP 호출을 자동으로 처리하는 클래스를 생성하여 웹 서비스 참조를 추가하는 것과 조금 비슷하게 작동합니다. 올바른 메소드를 호출하고 매개 변수를 전달하면됩니다.

관련 문제