ページの先頭行へ戻る
Interstage Application Server/Interstage Web Server J2EE ユーザーズガイド

C.2 SOAPメッセージの作成

SOAPエンベロープの構成要素を新規作成する場合はSOAPFactoryオブジェクトを使用します。
SOAPFactoryオブジェクトはSOAPFactoryクラスのnewInstanceクラスメソッドを使用して取得します。

 import javax.xml.soap.*;
      .....
   SOAPFactory sf = SOAPFactory.newInstance();
   SOAPElement el1 = sf.createElement(localName, prefix, nsuri);
   Name name = sf.createName(localName2, prefix, nsuri);
      .....

SOAPMessageオブジェクトを新規作成する場合はMessageFactoryオブジェクトを使用します。
MessageFactoryオブジェクトはMessageFactoryクラスのnewInstanceクラスメソッドを使用して取得します。

 import javax.xml.soap.*;
      .....
   MessageFactory mf = MessageFactory.newInstance();
   SOAPMessage msg = mf.createMessage();
   SOAPPart part = msg.getSOAPPart();
   SOAPEnvelope env = part.getEnvelope();
      .....