填充主体
...
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPElement;
public class SOAPTip {
   public static void main(String args[]) {
      try {
...
         //Create objects for the message parts            
         SOAPPart soapPart =     message.getSOAPPart();
         SOAPEnvelope envelope = soapPart.getEnvelope();
         SOAPBody body =         envelope.getBody();
        //Populate the body
        //Create the main element and namespace
        SOAPElement bodyElement = 
                  body.addChildElement(envelope.createName("schedule" , 
                                                                "cal", 
                                    "http://www.example.com/calendar"));
        //Add content
        bodyElement.addChildElement("cal:newitem").addTextNode("contentHere");
        //Save the message
        message.saveChanges();
        //Check the input
        System.out.println("\nREQUEST:\n");
        message.writeTo(System.out);
        System.out.println();
         //Close the connection            
         connection.close();
        } catch(Exception e) {
            System.out.println(e.getMessage());
        }
    }
}
  |