SOAP 인증이 필요한 .NET에서 작성된 웹 서비스를 사용하려고합니다. 가장 관심을 가질 부분은 다음과 같습니다.비누 인증 헤더가있는 Netbeans에서 .NET 웹 서비스를 사용하는 방법
<s:element name="SoapAuthenticationHeader" type="tns:SoapAuthenticationHeader" />
<s:complexType name="SoapAuthenticationHeader">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Username" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string" />
</s:sequence>
<s:anyAttribute />
</s:complexType>
Netbeans에서 웹 서비스를 성공적으로 사용할 수 있습니다. 자동 생성 스텁/메소드에서는 인증을 위해 사용자 이름과 암호를 넣을 수 없으므로 사용할 수 없습니다. 내가 JAX-WS를 사용하는 경우
JAX-WS 가장에서
try { // Call Web Service Operation
org.tempuri.TeleCast service = new org.tempuri.TeleCast();
org.tempuri.TeleCastSoap port = service.getTeleCastSoap();
// TODO initialize WS operation arguments here
int campaignid = 0;
java.lang.String to = "";
java.lang.String from = "";
java.lang.String subject = "";
java.lang.String body = "";
java.lang.String uniqueid = "";
// TODO process result here
boolean result = port.queueRealTimeEmail(campaignid, to, from, subject, body, uniqueid);
System.out.println("Result = "+result);
} catch (Exception ex) {
// TODO handle custom exceptions here
}
JAX-RPC
try { // This code block invokes the TeleCastSoap:queueRealTimeEmail operation on web service
telecastclient.TeleCast teleCast = new telecastclient.TeleCast_Impl();
telecastclient.TeleCastSoap teleCastSoap = teleCast.getTeleCastSoap();
teleCastSoap.queueRealTimeEmail(/* TODO enter operation arguments*/);
} catch(javax.xml.rpc.ServiceException ex) {
java.util.logging.Logger.getLogger(telecastclient.TeleCast.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch(java.rmi.RemoteException ex) {
java.util.logging.Logger.getLogger(telecastclient.TeleCast.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch(Exception ex) {
java.util.logging.Logger.getLogger(telecastclient.TeleCast.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
:
넷빈즈의 자동 스텁은 다음을 포함되어 생성 메서드를 사용하면 사용자 이름과 암호를 설정할 수있는 SoapAuthenticationHeader라는 클래스가 생깁니다. 하지만 다양한 작업을 수행하기 전에 또는 웹 서비스 호출을 수행하는 동안 SoapAuthenticationHeader 객체를 전달하는 방법을 모르겠습니다.
org.tempuri.SoapAuthenticationHeader auth = new SoapAuthenticationHeader();
auth.setUsername("username");
auth.setPassword("password");
JAX-RPC 방법에서는이 옵션이 없습니다.
위의 내용은 크게 감사하겠습니다. 시간 내 주셔서 감사드립니다.