SOAP認証が必要な.NETで作成されたWebサービスを使用しようとしています。あなたが最も興味を持つ部分は次のとおりです。soap認証ヘッダーを持つNetbeansで.NET Webサービスを使用する方法
<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で正常にWebサービスを使用することができました。自動生成されたスタブ/メソッドでは、認証にユーザー名とパスワードを使用できないため、使用できません。 Iは、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);
}
:
のNetBeans自動スタブのために以下を含む生成
私はユーザー名とパスワードを設定できるSoapAuthenticationHeaderというクラスを取得します。しかし、私は、SoapAuthenticationHeaderのオブジェクトをWebサービス呼び出しの前または途中で渡して、さまざまな操作を実行する方法を知らない。org.tempuri.SoapAuthenticationHeader auth = new SoapAuthenticationHeader();
auth.setUsername("username");
auth.setPassword("password");
私は、JAX-RPCの方法でこのオプションを持っていません。
これに関するすべてのご意見をいただければ幸いです。あなたの時間を事前に感謝します。