コード例 #1
0
ファイル: SOAPFaultTest.java プロジェクト: veithen/ddom
 @Validated
 @Test
 public final void testAddDetailEntryUsingQName() throws Exception {
   Detail detail = createEmptySOAPFault().addDetail();
   DetailEntry detailEntry = detail.addDetailEntry(new QName("urn:ns", "mydetail", "p"));
   assertEquals("urn:ns", detailEntry.getNamespaceURI());
   assertEquals("mydetail", detailEntry.getLocalName());
   assertEquals("p", detailEntry.getPrefix());
   assertSame(detailEntry, detail.getFirstChild());
 }
コード例 #2
0
ファイル: SOAPFaultTest.java プロジェクト: veithen/ddom
 @Validated
 @Test
 public final void testAddDetailEntryUsingName() throws Exception {
   SOAPEnvelope envelope = createSOAPEnvelope();
   Detail detail = envelope.addBody().addFault().addDetail();
   DetailEntry detailEntry = detail.addDetailEntry(envelope.createName("mydetail", "p", "urn:ns"));
   assertEquals("urn:ns", detailEntry.getNamespaceURI());
   assertEquals("mydetail", detailEntry.getLocalName());
   assertEquals("p", detailEntry.getPrefix());
   assertSame(detailEntry, detail.getFirstChild());
 }
コード例 #3
0
ファイル: SOAPFaultTest.java プロジェクト: veithen/ddom
 @Validated
 @Test
 public final void testAddDetailEntryUsingQNameWithoutNamespace() throws Exception {
   Detail detail = createEmptySOAPFault().addDetail();
   DetailEntry detailEntry = detail.addDetailEntry(new QName("mydetail"));
   // TODO: Sun's implementation returns an empty string here (which I believe is incorrect)
   //        assertNull(detailEntry.getNamespaceURI());
   assertEquals("mydetail", detailEntry.getLocalName());
   assertNull(detailEntry.getPrefix());
   assertSame(detailEntry, detail.getFirstChild());
 }
コード例 #4
0
ファイル: SOAPFaultTest.java プロジェクト: veithen/ddom
 @Validated
 @Test
 public final void testCreateDetailEntryUsingCreateElementNS() throws Exception {
   SOAPFault fault = createEmptySOAPFault();
   Detail detail = fault.addDetail();
   detail.appendChild(fault.getOwnerDocument().createElementNS("urn:ns", "p:test"));
   Iterator<?> it = detail.getDetailEntries();
   assertTrue(it.hasNext());
   // The implementation silently replaces the Element by a DetailEntry
   DetailEntry detailEntry = (DetailEntry) it.next();
   assertEquals("urn:ns", detailEntry.getNamespaceURI());
   assertEquals("test", detailEntry.getLocalName());
 }
コード例 #5
0
ファイル: EchoImpl.java プロジェクト: julienfromentc/jaxws
  private SOAPFaultException createSOAPFaultException() {
    try {
      String namespace = "http://example.com/auctiontraq/schemas/doclit";
      SOAPFactory soapFactory = SOAPFactory.newInstance();
      Name name = soapFactory.createName("MySOAPFault", "ns0", namespace);
      Detail detail = soapFactory.createDetail();
      DetailEntry entry = detail.addDetailEntry(name);
      entry.addNamespaceDeclaration("data", namespace);
      Name attrName1 = soapFactory.createName("myAttr", "data", namespace);
      entry.addAttribute(attrName1, "myvalue");
      SOAPElement child = entry.addChildElement("message");
      child.addTextNode("Server Exception");

      Name name2 = soapFactory.createName("ExtraInformation", "ns0", namespace);
      DetailEntry entry2 = detail.addDetailEntry(name2);

      SOAPElement child2 = entry2.addChildElement("Reason");
      child2.addTextNode("Address Not Found");

      QName qname = new QName("http://schemas.xmlsoap.org/soap/envelope/", "server");
      SOAPFault sf = soapFactory.createFault("SOAP Fault Exception:Address Not Found", qname);
      org.w3c.dom.Node n = sf.getOwnerDocument().importNode(detail, true);
      sf.appendChild(n);
      return new SOAPFaultException(sf);
      // printDetail(detail);
      // return new SOAPFaultException(qname,
      //       "SOAP Fault Exception:Address Not Found", null, detail);

    } catch (SOAPException e) {
      e.printStackTrace();
      // QName qname = new QName("http://schemas.xmlsoap.org/soap/envelope/", "client");
      throw new WebServiceException("Exception While Creating SOAP Fault Exception", e);
    }
  }