List of usage examples for javax.xml.ws.soap SOAPFaultException printStackTrace
public void printStackTrace()
From source file:fr.xebia.demo.ws.employee.EmployeeServiceIntegrationTest.java
@Test(expected = SOAPFaultException.class) public void testPutEmployeeFirstNameMissing() throws Exception { int id = random.nextInt(); Employee employee = new Employee(); employee.setId(id);/*from w ww. ja v a 2 s . c o m*/ employee.setLastName("Doe-" + id); employee.setFirstName(null); employee.setGender(Gender.MALE); employee.setBirthdate(new Date(new GregorianCalendar(1976, 01, 05).getTimeInMillis())); try { employeeService.putEmployee(new Holder<Employee>(employee)); } catch (SOAPFaultException e) { e.printStackTrace(); throw e; } /* * throws javax.xml.ws.soap.SOAPFaultException: Marshalling Error: cvc-complex-type.2.4.b: The content of element 'employee' is not * complete. One of '{"http://demo.xebia.fr/xml/employee":firstName}' is expected. */ }
From source file:fr.xebia.demo.ws.employee.EmployeeServiceIntegrationTest.java
@Test(expected = SOAPFaultException.class) public void testPutEmployeeFirstNameTooLong() throws Exception { int id = random.nextInt(); Employee employee = new Employee(); employee.setId(id);//from ww w .j av a 2s .c o m employee.setLastName("Doe-" + id); String firstName = StringUtils.repeat("John ", 100); Assert.assertTrue("firstName must be longer than 256 chars to exceed Schema constraint", firstName.length() > 256); employee.setFirstName(firstName); employee.setGender(Gender.MALE); employee.setBirthdate(new Date(new GregorianCalendar(1976, 01, 05).getTimeInMillis())); try { employeeService.putEmployee(new Holder<Employee>(employee)); } catch (SOAPFaultException e) { e.printStackTrace(); throw e; } /* * throws javax.xml.ws.soap.SOAPFaultException: Marshalling Error: cvc-maxLength-valid: Value '...' with length = '500' is not * facet-valid with respect to maxLength '256' for type '#AnonType_firstNameEmployee'. */ }
From source file:org.apache.juddi.v3.tck.UDDI_141_JIRAIntegrationTest.java
/** * sets up a compelte publisher assertion * * @throws Exception//w ww .ja v a2s . co m */ @Test public void JUDDI_590() throws Exception { Assume.assumeTrue(TckPublisher.isEnabled()); //create two businesses System.out.println("JUDDI_590"); SaveBusiness sb = new SaveBusiness(); sb.setAuthInfo(authInfoJoe); BusinessEntity be = new BusinessEntity(); Name n = new Name(); n.setValue("JUDDI_590 Joe"); be.getName().add(n); sb.getBusinessEntity().add(be); String joeBiz = null; try { BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb); joeBiz = saveBusiness.getBusinessEntity().get(0).getBusinessKey(); //DeleteBusiness db = new DeleteBusiness(); //db.setAuthInfo(authInfoJoe); //db.getBusinessKey().add(saveBusiness.getBusinessEntity().get(0).getBusinessKey()); //publicationJoe.deleteBusiness(db); //Assert.fail("request should have been rejected"); } catch (SOAPFaultException ex) { HandleException(ex); } sb = new SaveBusiness(); sb.setAuthInfo(authInfoSam); be = new BusinessEntity(); n = new Name(); n.setValue("JUDDI_590 Sam"); be.getName().add(n); sb.getBusinessEntity().add(be); String samBiz = null; try { BusinessDetail saveBusiness = publicationSam.saveBusiness(sb); samBiz = saveBusiness.getBusinessEntity().get(0).getBusinessKey(); //DeleteBusiness db = new DeleteBusiness(); //db.setAuthInfo(authInfoJoe); //db.getBusinessKey().add(saveBusiness.getBusinessEntity().get(0).getBusinessKey()); //publicationJoe.deleteBusiness(db); //Assert.fail("request should have been rejected"); } catch (SOAPFaultException ex) { HandleException(ex); } //create an assertion on one end AddPublisherAssertions apa = new AddPublisherAssertions(); apa.setAuthInfo(authInfoJoe); apa.getPublisherAssertion().add(new PublisherAssertion()); apa.getPublisherAssertion().get(0).setFromKey(joeBiz); apa.getPublisherAssertion().get(0).setToKey(samBiz); KeyedReference kr = new KeyedReference(); kr.setKeyName("Subsidiary"); kr.setKeyValue("parent-child"); kr.setTModelKey("uddi:uddi.org:relationships"); apa.getPublisherAssertion().get(0).setKeyedReference(kr); publicationJoe.addPublisherAssertions(apa); //check get status is not null from 1 and from 2 boolean ok = true; String msg = ""; try { List<AssertionStatusItem> assertionStatusReport = publicationJoe.getAssertionStatusReport(authInfoJoe, CompletionStatus.STATUS_TO_KEY_INCOMPLETE); if (assertionStatusReport.isEmpty()) { msg = "Stage1: no result returned, expected at least 1"; ok = false; } for (int i = 0; i < assertionStatusReport.size(); i++) { JAXB.marshal(assertionStatusReport.get(i), System.out); if (assertionStatusReport.get(i).getToKey().equals(samBiz)) { if (!assertionStatusReport.get(i).getCompletionStatus() .equals(CompletionStatus.STATUS_TO_KEY_INCOMPLETE)) { ok = false; msg = "Stage1: status type mismatch"; } } } } catch (Exception ex) { ok = false; ex.printStackTrace(); } //aprove the assertion from sam apa = new AddPublisherAssertions(); apa.setAuthInfo(authInfoSam); apa.getPublisherAssertion().add(new PublisherAssertion()); apa.getPublisherAssertion().get(0).setFromKey(joeBiz); apa.getPublisherAssertion().get(0).setToKey(samBiz); kr = new KeyedReference(); kr.setKeyName("Subsidiary"); kr.setKeyValue("parent-child"); kr.setTModelKey("uddi:uddi.org:relationships"); apa.getPublisherAssertion().get(0).setKeyedReference(kr); publicationSam.addPublisherAssertions(apa); try { List<AssertionStatusItem> assertionStatusReport = publicationJoe.getAssertionStatusReport(authInfoJoe, CompletionStatus.STATUS_COMPLETE); if (assertionStatusReport.isEmpty()) { msg = "Stage2: no result returned, expected at least 1"; ok = false; } for (int i = 0; i < assertionStatusReport.size(); i++) { JAXB.marshal(assertionStatusReport.get(i), System.out); if (assertionStatusReport.get(i).getToKey().equals(samBiz)) { if (!assertionStatusReport.get(i).getCompletionStatus() .equals(CompletionStatus.STATUS_COMPLETE)) { ok = false; msg = "Stage2: status type mismatch"; } } } //test to see what the status actually is if (!ok) { assertionStatusReport = publicationJoe.getAssertionStatusReport(authInfoJoe, CompletionStatus.STATUS_FROM_KEY_INCOMPLETE); for (int i = 0; i < assertionStatusReport.size(); i++) { JAXB.marshal(assertionStatusReport.get(i), System.out); if (assertionStatusReport.get(i).getToKey().equals(samBiz)) { msg = "Stage3: status is " + assertionStatusReport.get(i).getCompletionStatus().toString() + " instead of complete"; } } assertionStatusReport = publicationJoe.getAssertionStatusReport(authInfoJoe, CompletionStatus.STATUS_TO_KEY_INCOMPLETE); for (int i = 0; i < assertionStatusReport.size(); i++) { JAXB.marshal(assertionStatusReport.get(i), System.out); if (assertionStatusReport.get(i).getToKey().equals(samBiz)) { msg = "Stage3: status is " + assertionStatusReport.get(i).getCompletionStatus().toString() + " instead of complete"; } } assertionStatusReport = publicationJoe.getAssertionStatusReport(authInfoJoe, CompletionStatus.STATUS_BOTH_INCOMPLETE); for (int i = 0; i < assertionStatusReport.size(); i++) { JAXB.marshal(assertionStatusReport.get(i), System.out); if (assertionStatusReport.get(i).getToKey().equals(samBiz)) { msg = "Stage3: status is " + assertionStatusReport.get(i).getCompletionStatus().toString() + " instead of complete"; } } } } catch (Exception ex) { ok = false; ex.printStackTrace(); } List<String> biz = new ArrayList<String>(); biz.add(samBiz); DeleteBusinesses(biz, authInfoSam, publicationSam); biz = new ArrayList<String>(); biz.add(joeBiz); DeleteBusinesses(biz, authInfoJoe, publicationJoe); Assert.assertTrue(msg, ok); }
From source file:org.apache.juddi.v3.tck.UDDI_141_JIRAIntegrationTest.java
/** * setups up a partial relationship and confirms its existence * * @throws Exception/*w w w .j ava 2s. com*/ */ @Test public void JUDDI_590_1() throws Exception { Assume.assumeTrue(TckPublisher.isEnabled()); //create two businesses System.out.println("JUDDI_590_1"); SaveBusiness sb = new SaveBusiness(); sb.setAuthInfo(authInfoJoe); BusinessEntity be = new BusinessEntity(); Name n = new Name(); n.setValue("JUDDI_590 Joe"); be.getName().add(n); sb.getBusinessEntity().add(be); String joeBiz = null; try { BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb); joeBiz = saveBusiness.getBusinessEntity().get(0).getBusinessKey(); //DeleteBusiness db = new DeleteBusiness(); //db.setAuthInfo(authInfoJoe); //db.getBusinessKey().add(saveBusiness.getBusinessEntity().get(0).getBusinessKey()); //publicationJoe.deleteBusiness(db); //Assert.fail("request should have been rejected"); } catch (SOAPFaultException ex) { HandleException(ex); } sb = new SaveBusiness(); sb.setAuthInfo(authInfoSam); be = new BusinessEntity(); n = new Name(); n.setValue("JUDDI_590 Sam"); be.getName().add(n); sb.getBusinessEntity().add(be); String samBiz = null; try { BusinessDetail saveBusiness = publicationSam.saveBusiness(sb); samBiz = saveBusiness.getBusinessEntity().get(0).getBusinessKey(); //DeleteBusiness db = new DeleteBusiness(); //db.setAuthInfo(authInfoJoe); //db.getBusinessKey().add(saveBusiness.getBusinessEntity().get(0).getBusinessKey()); //publicationJoe.deleteBusiness(db); //Assert.fail("request should have been rejected"); } catch (SOAPFaultException ex) { HandleException(ex); } //create an assertion on one end AddPublisherAssertions apa = new AddPublisherAssertions(); apa.setAuthInfo(authInfoJoe); apa.getPublisherAssertion().add(new PublisherAssertion()); apa.getPublisherAssertion().get(0).setFromKey(joeBiz); apa.getPublisherAssertion().get(0).setToKey(samBiz); KeyedReference kr = new KeyedReference(); kr.setKeyName("Subsidiary"); kr.setKeyValue("parent-child"); kr.setTModelKey("uddi:uddi.org:relationships"); apa.getPublisherAssertion().get(0).setKeyedReference(kr); publicationJoe.addPublisherAssertions(apa); //ok so joe has asserted that he knows sam //check get status is not null from 1 and from 2 boolean ok = true; String msg = ""; try { List<AssertionStatusItem> assertionStatusReport = publicationJoe.getAssertionStatusReport(authInfoJoe, CompletionStatus.STATUS_TO_KEY_INCOMPLETE); if (assertionStatusReport.isEmpty()) { msg = "Stage1: no result returned, expected at least 1"; ok = false; } for (int i = 0; i < assertionStatusReport.size(); i++) { if (TckCommon.isDebug()) { JAXB.marshal(assertionStatusReport.get(i), System.out); } if (assertionStatusReport.get(i).getToKey().equals(samBiz)) { if (!assertionStatusReport.get(i).getCompletionStatus() .equals(CompletionStatus.STATUS_TO_KEY_INCOMPLETE)) { ok = false; msg = "Stage1: status type mismatch"; } } } } catch (Exception ex) { ok = false; ex.printStackTrace(); } //check that sam got the message try { List<AssertionStatusItem> assertionStatusReport = publicationSam.getAssertionStatusReport(authInfoSam, CompletionStatus.STATUS_TO_KEY_INCOMPLETE); if (assertionStatusReport.isEmpty()) { msg = "Stage2: no result returned, expected at least 1"; ok = false; } for (int i = 0; i < assertionStatusReport.size(); i++) { if (TckCommon.isDebug()) { JAXB.marshal(assertionStatusReport.get(i), System.out); } if (assertionStatusReport.get(i).getToKey().equals(samBiz)) { if (!assertionStatusReport.get(i).getCompletionStatus() .equals(CompletionStatus.STATUS_TO_KEY_INCOMPLETE)) { ok = false; msg = "Stage2: status type mismatch"; } } } } catch (Exception ex) { ok = false; ex.printStackTrace(); } List<String> biz = new ArrayList<String>(); biz.add(samBiz); DeleteBusinesses(biz, authInfoSam, publicationSam); biz = new ArrayList<String>(); biz.add(joeBiz); DeleteBusinesses(biz, authInfoJoe, publicationJoe); Assert.assertTrue(msg, ok); }
From source file:uk.ac.ebi.demo.picr.swing.PICRBLASTDemo.java
public PICRBLASTDemo() { //set general layout setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); add(Box.createVerticalStrut(5)); //create components JPanel row1 = new JPanel(); row1.setLayout(new BoxLayout(row1, BoxLayout.X_AXIS)); row1.add(Box.createHorizontalStrut(5)); row1.setBorder(BorderFactory.createTitledBorder("")); row1.add(new JLabel("Fragment:")); row1.add(Box.createHorizontalStrut(10)); final JTextArea sequenceArea = new JTextArea(5, 40); sequenceArea.setMaximumSize(sequenceArea.getPreferredSize()); row1.add(Box.createHorizontalStrut(10)); row1.add(sequenceArea);// w w w . j av a 2 s.co m row1.add(Box.createHorizontalGlue()); JPanel row2 = new JPanel(new FlowLayout(FlowLayout.LEFT)); row2.setBorder(BorderFactory.createTitledBorder("Target Databases")); final JList databaseList = new JList(); JScrollPane listScroller = new JScrollPane(databaseList); listScroller.setMaximumSize(new Dimension(100, 10)); JButton loadDBButton = new JButton("Load Databases"); row2.add(listScroller); row2.add(loadDBButton); JPanel row3 = new JPanel(new FlowLayout(FlowLayout.LEFT)); JCheckBox onlyActiveCheckBox = new JCheckBox("Only Active"); onlyActiveCheckBox.setSelected(true); row3.add(new JLabel("Options: ")); row3.add(onlyActiveCheckBox); add(row1); add(row2); add(row3); final String[] columns = new String[] { "Database", "Accession", "Version", "Taxon ID" }; final JTable dataTable = new JTable(new Object[0][0], columns); dataTable.setShowGrid(true); add(new JScrollPane(dataTable)); JPanel buttonPanel = new JPanel(); JButton mapAccessionButton = new JButton("Generate Mapping!"); buttonPanel.add(mapAccessionButton); add(buttonPanel); //create listeners! //update boolean flag in communication class onlyActiveCheckBox.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { client.setOnlyActive(((JCheckBox) e.getSource()).isSelected()); } }); //performs mapping call and updates interface with results mapAccessionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { if (!"".equals(sequenceArea.getText())) { //TODO filters and database are hardcoded here. They should be added to the input panel at a later revision. java.util.List<UPEntry> entries = client.performBlastMapping(sequenceArea.getText(), databaseList.getSelectedValues(), "90", "", "IDENTITY", "UniprotKB", "", false, new BlastParameter()); //compute size of array if (entries != null) { int size = 0; for (UPEntry entry : entries) { for (CrossReference xref : entry.getIdenticalCrossReferences()) { size++; } for (CrossReference xref : entry.getLogicalCrossReferences()) { size++; } } if (size > 0) { final Object[][] data = new Object[size][4]; int i = 0; for (UPEntry entry : entries) { for (CrossReference xref : entry.getIdenticalCrossReferences()) { data[i][0] = xref.getDatabaseName(); data[i][1] = xref.getAccession(); data[i][2] = xref.getAccessionVersion(); data[i][3] = xref.getTaxonId(); i++; } for (CrossReference xref : entry.getLogicalCrossReferences()) { data[i][0] = xref.getDatabaseName(); data[i][1] = xref.getAccession(); data[i][2] = xref.getAccessionVersion(); data[i][3] = xref.getTaxonId(); i++; } } //refresh DefaultTableModel dataModel = new DefaultTableModel(); dataModel.setDataVector(data, columns); dataTable.setModel(dataModel); System.out.println("update done"); } else { JOptionPane.showMessageDialog(null, "No Mappind data found."); } } else { JOptionPane.showMessageDialog(null, "No Mappind data found."); } } else { JOptionPane.showMessageDialog(null, "You must enter a valid FASTA sequence to map."); } } catch (SOAPFaultException soapEx) { JOptionPane.showMessageDialog(null, "A SOAP Error occurred."); soapEx.printStackTrace(); } } }); //loads list of mapping databases from communication class loadDBButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { java.util.List<String> databases = client.loadDatabases(); if (databases != null && databases.size() > 0) { databaseList.setListData(databases.toArray()); System.out.println("database refresh done"); } else { JOptionPane.showMessageDialog(null, "No Databases Loaded!."); } } catch (SOAPFaultException soapEx) { JOptionPane.showMessageDialog(null, "A SOAP Error occurred."); soapEx.printStackTrace(); } } }); }