JavaTM Platform
Standard Ed. 6

javax.xml.soap
인터페이스 SOAPEnvelope

모든 슈퍼 인터페이스:
Element , Node , SOAPElement


public interface SOAPEnvelope
extends SOAPElement

SOAPPart 객체의 SOAPHeader 와 SOAPBody 부분의 컨테이너입니다. 디폴트에서는,SOAPMessage 객체는 SOAPEnvelope 객체를 보관 유지하는 SOAPPart 객체로 작성됩니다. 디폴트의 SOAPEnvelope 객체는, 빈 상태(empty)의 SOAPBody 객체와 빈 상태(empty)의 SOAPHeader 객체를 보유하고 있습니다. SOAPBody 객체는 필수입니다. SOAPHeader 객체는 임의입니다만, 대부분의 경우에 사용되고 있습니다. SOAPHeader 객체가 필요하지 않은 경우, 삭제할 수 있습니다 (후술).  

클라이언트는,SOAPEnvelope.getHeaderSOAPEnvelope.getBody 메소드를 호출하는 것으로,SOAPHeaderSOAPBody 객체에 액세스 할 수 있습니다. 다음의 코드에서는,SOAPMessage 객체의 messageSOAPPart 객체의 sp 를 취득한 뒤, 이러한 2 개의 메소드를 사용합니다. sp 는 다음의 SOAPEnvelope 객체의 se 의 취득에 사용합니다.

     SOAPPart sp = message.getSOAPPart();
     SOAPEnvelope se = sp.getEnvelope();
     SOAPHeader sh = se.getHeader();
     SOAPBody sb = se.getBody();
 

SOAPEnvelope 객체의 본체나 헤더는, 현행의 것을 취득하거나 삭제하거나 새로운 것을 추가하거나 하는 것으로 변경할 수 있습니다. javax.xml.soap.Node 의 메소드 deleteNode 는, 불려 간 XML 요소 (노드)를 삭제합니다. 예를 들어, 다음의 코드는,getBody 메소드로 취득한 SOAPBody 객체를 삭제합니다.

      se.getBody(). detachNode();
 
SOAPHeader 객체를 작성해 삭제한 것과 옮겨놓는 경우, 클라이언트는,SOAPEnvelope.addHeader 메소드를 사용합니다. 이 메소드를 사용하면(자), 새로운 헤더를 작성해,SOAPEnvelope 객체에 추가할 수 있습니다. 같이addBody 메소드도 새로운 SOAPBody 객체를 작성해,SOAPEnvelope 객체에 추가합니다. 다음의 코드의 발췌에서는, 현재의 헤더를 취득해 그것을 삭제해, 새로운 것을 추가합니다. 계속되어, 현재의 본체를 취득해 그것을 삭제해, 새로운 것을 추가합니다.
     SOAPPart sp = message.getSOAPPart();
     SOAPEnvelope se = sp.getEnvelope();
     se.getHeader(). detachNode();
     SOAPHeader sh = se.addHeader();
     se.getBody(). detachNode();
     SOAPBody sb = se.addBody();
 
벌써 SOAPBody 객체나 SOAPHeader 객체가 존재하고 있는 경우, 이것들을 추가하면(자) 에러가 됩니다.  

SOAPEnvelope 인터페이스는,Name 객체를 작성하는 3 개의 메소드를 제공합니다. 1 개째의 메소드는, 로컬명, 이름 공간 접두사, 이름 공간 URI 를 사용해 Name 객체를 작성합니다. 2 개째의 메소드는, 로컬명과 이름 공간의 접두사를 사용해 Name 를 작성합니다. 3 개째의 메소드는, 로컬명만을 사용해 Name 를 작성합니다. 다음의 코드 (seSOAPEnvelope 객체)에, 3 개(살) 모든 인수를 사용해 새로운 Name 객체를 작성하는 예를 나타냅니다.

     Name name = se.createName("GetLastTradePrice", "WOMBAT",
                                "http://www.wombat.org/trader");
 


필드의 개요
 
인터페이스 org.w3c.dom. Node 로부터 상속된 필드
ATTRIBUTE_NODE , CDATA_SECTION_NODE , COMMENT_NODE , DOCUMENT_FRAGMENT_NODE , DOCUMENT_NODE , DOCUMENT_POSITION_CONTAINED_BY , DOCUMENT_POSITION_CONTAINS , DOCUMENT_POSITION_DISCONNECTED , DOCUMENT_POSITION_FOLLOWING , DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC , DOCUMENT_POSITION_PRECEDING , DOCUMENT_TYPE_NODE , ELEMENT_NODE , ENTITY_NODE , ENTITY_REFERENCE_NODE , NOTATION_NODE , PROCESSING_INSTRUCTION_NODE , TEXT_NODE
 
메소드의 개요
 SOAPBody addBody ()
          SOAPBody 객체를 작성해, 이 SOAPEnvelope 객체의 SOAPBody 객체로서 설정합니다.
 SOAPHeader addHeader ()
          SOAPHeader 객체를 작성해, 이 SOAPEnvelope 객체의 SOAPHeader 객체로서 설정합니다.
 Name createName (String  localName)
          지정의 로컬명으로 초기화된 Name 객체를 새롭게 작성합니다.
 Name createName (String  localName, String  prefix, String  uri)
          지정의 로컬명, 이름 공간 접두사, 이름 공간 URI 로 초기화된 Name 객체를 새롭게 작성합니다.
 SOAPBody getBody ()
          이 SOAPEnvelope 객체에 관련한 SOAPBody 객체를 돌려줍니다.
 SOAPHeader getHeader ()
          이 SOAPEnvelope 객체의 SOAPHeader 객체를 돌려줍니다.
 
인터페이스 javax.xml.soap. SOAPElement 로부터 상속된 메소드
addAttribute , addAttribute , addChildElement , addChildElement , addChildElement , addChildElement , addChildElement , addChildElement , addNamespaceDeclaration , addTextNode , createQName , getAllAttributes , getAllAttributesAsQNames , getAttributeValue , getAttributeValue , getChildElements , getChildElements , getChildElements , getElementName , getElementQName , getEncodingStyle , getNamespacePrefixes , getNamespaceURI , getVisibleNamespacePrefixes , removeAttribute , removeAttribute , removeContents , removeNamespaceDeclaration , setElementQName , setEncodingStyle
 
인터페이스 javax.xml.soap. Node 로부터 상속된 메소드
detachNode , getParentElement , getValue , recycleNode , setParentElement , setValue
 
인터페이스 org.w3c.dom. Element 로부터 상속된 메소드
getAttribute , getAttributeNode , getAttributeNodeNS , getAttributeNS , getElementsByTagName , getElementsByTagNameNS , getSchemaTypeInfo , getTagName , hasAttribute , hasAttributeNS , removeAttribute , removeAttributeNode , removeAttributeNS , setAttribute , setAttributeNode , setAttributeNodeNS , setAttributeNS , setIdAttribute , setIdAttributeNode , setIdAttributeNS
 
인터페이스 org.w3c.dom. Node 로부터 상속된 메소드
appendChild , cloneNode , compareDocumentPosition , getAttributes , getBaseURI , getChildNodes , getFeature , getFirstChild , getLastChild , getLocalName , getNamespaceURI , getNextSibling , getNodeName , getNodeType , getNodeValue , getOwnerDocument , getParentNode , getPrefix , getPreviousSibling , getTextContent , getUserData , hasAttributes , hasChildNodes , insertBefore , isDefaultNamespace , isEqualNode , isSameNode , isSupported , lookupNamespaceURI , lookupPrefix , normalize , removeChild , replaceChild , setNodeValue , setPrefix , setTextContent , setUserData
 

메소드의 상세

createName

Name  createName(String  localName,
                String  prefix,
                String  uri)
                throws SOAPException 
지정의 로컬명, 이름 공간 접두사, 이름 공간 URI 로 초기화된 Name 객체를 새롭게 작성합니다.  

이 팩토리 메소드는, SOAP/XML 문서로 사용하는 Name 객체를 작성합니다.

파라미터:
localName - 로컬명을 제공하는 String
prefix - 이름 공간의 접두사를 제공하는 String
uri - 이름 공간의 URI 를 제공하는 String
반환값:
지정의 로컬명, 이름 공간 접두사, 이름 공간 URI 로 초기화되었다 Name 객체
예외:
SOAPException - SOAP 에러가 발생했을 경우

createName

Name  createName(String  localName)
                throws SOAPException 
지정의 로컬명으로 초기화된 Name 객체를 새롭게 작성합니다.  

이 팩토리 메소드는, SOAP/XML 문서로 사용하는 Name 객체를 작성합니다.

파라미터:
localName - 로컬명을 제공하는 String
반환값:
지정의 로컬명으로 초기화된 Name 객체
예외:
SOAPException - SOAP 에러가 발생했을 경우

getHeader

SOAPHeader  getHeader()
                     throws SOAPException 
SOAPEnvelope 객체의 SOAPHeader 객체를 돌려줍니다.  

디폴트에서는, 새로운 SOAPMessage 객체의 작성에, 빈 상태(empty)의 SOAPHeader 객체를 보관 유지하는 SOAPEnvelope 객체를 사용합니다. 그 때문에,getHeader 메소드는, 헤더를 삭제해 새로운 것이 추가되지 않았던 경우를 제외해, 항상 SOAPHeader 객체를 돌려줍니다.

반환값:
SOAPHeader 객체, 존재하지 않는 경우는 null
예외:
SOAPException - SOAPHeader 객체의 취득에 문제가 발생했을 경우

getBody

SOAPBody  getBody()
                 throws SOAPException 
SOAPEnvelope 객체에 관련한 SOAPBody 객체를 돌려줍니다.  

디폴트에서는, 새로운 SOAPMessage 객체의 작성에, 빈 상태(empty)의 SOAPBody 객체를 보관 유지하는 SOAPEnvelope 객체를 사용합니다. 그 때문에,getBody 메소드는, 본체를 삭제해 새로운 것이 추가되지 않았던 경우를 제외해, 항상 SOAPBody 객체를 돌려줍니다.

반환값:
SOAPEnvelope 객체의 SOAPBody 객체, 존재하지 않는 경우는 null
예외:
SOAPException - SOAPBody 객체의 취득에 문제가 발생했을 경우

addHeader

SOAPHeader  addHeader()
                     throws SOAPException 
SOAPHeader 객체를 작성해, 이 SOAPEnvelope 객체의 SOAPHeader 객체로서 설정합니다.  

포락선에 벌써 헤더가 포함되어 있는 경우, 헤더를 추가할 수 없습니다. 그 때문에, 이 메소드는 기존의 헤더를 삭제하고 나서 호출해 주세요.

반환값:
새로운 SOAPHeader 객체
예외:
SOAPException - 이 SOAPEnvelope 객체가 벌써 유효한SOAPHeader 객체를 보유하고 있는 경우

addBody

SOAPBody  addBody()
                 throws SOAPException 
SOAPBody 객체를 작성해, 이 SOAPEnvelope 객체의 SOAPBody 객체로서 설정합니다.  

포락선에 벌써 본체가 포함되어 있는 경우, 본체를 추가할 수 없습니다. 그 때문에, 이 메소드는 기존의 본체를 삭제하고 나서 호출해 주세요.

반환값:
새로운 SOAPBody 객체
예외:
SOAPException - 이 SOAPEnvelope 객체가 벌써 유효한 SOAPBody 객체를 보유하고 있는 경우

JavaTM Platform
Standard Ed. 6

버그의 보고와 기능의 요청
한층 더 자세한 API 레퍼런스 및 개발자 문서에 대해서는,Java SE 개발자용 문서를 참조해 주세요. 개발자전용의 상세한 해설, 개념의 개요, 용어의 정의, 버그의 회피책, 및 코드 실례가 포함되어 있습니다.

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.