XML 文書およびビジネス・オブジェクトは、検証サービスを使用して検証することができます。
また、他のサービスでは一定の最低基準が必要で、満たさなければランタイム例外を throw します。これらの 1 つが BOXMLSerializer です。
XML 検証の例外によって生成されたメッセージは、ログを表示して確認できます。以下の例は、BOXMLSerializer によって検証され、XML コーディングが正しくないために生成されたメッセージです。
javax.xml.ws.WebServiceException: org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: Element type "TestResponse" must be followed by either attribute specifications, ">" or "/>". javax.xml.ws.WebServiceException: org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope
[9/11/08 15:16:27:417 CDT] 0000003e ExceptionUtil E CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "transactionNotSupportedActivitySessionNotSupported" on bean "BeanId(WSXMLValidationApp#WSXMLValidationEJB.jar#Module, null)". Exception data: WebServicesFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException faultString: org.xml.sax.SAXParseException: Element type "TestResponse" must be followed by either attribute specifications, ">" or "/>". Message being parsed: <?xml version="1.0"?><TestResponse xmlns="http://WSXMLValidation"<firstName>Bob</firstName> <lastName>Smith</lastName></TestResponse> faultActor: null faultDetail: [9/11/08 15:16:35:135 CDT] 0000003f ExceptionUtil E CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "transactionNotSupportedActivitySessionNotSupported" on bean "BeanId(WSXMLValidationApp#WSXMLValidationEJB.jar#Module, null)". Exception data: WebServicesFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException faultString: org.xml.sax.SAXException: WSWS3066E: Error: Expected 'envelope' but found TestResponse Message being parsed: <?xml version="1.0"?><TestResponse xmlns="http://WSXMLValidation"> <firstName>Bob</firstName><middleName>John</middleName> <lastName>Smith</lastName> </TestResponse> faultActor: null faultDetail:
[9/11/08 15:35:13:401 CDT] 00000064 WebServicesSe E com.ibm.ws.webservices.engine.transport.http.WebServicesServlet getSoapAction WSWS3112E: Error: Generating WebServicesFault due to missing SOAPAction. WebServicesFault faultCode: Client.NoSOAPAction faultString: WSWS3147E: Error: no SOAPAction header! faultActor: null faultDetail:
検証サービスについて詳しくは、『Reference』セクションの『Generated API and SPI』の資料にある BOInstanceValidator インターフェースの項目を参照してください。