|
List Info
Thread: FW: I have a problem with delete service class
|
|
| FW: I have a problem with delete service
class |
  United Arab Emirates |
2007-05-28 13:49:19 |
|
From: "smart 84" <tame_84 hotmail.com> Reply-To: juddi-user ws.apache.org To: juddi-user ws.apache.org Subject: I have a problem with delete service class Date: Sat, 26 May 2007 21:32:56 +0400
Hi..
I am working in a project that will allow provider publishing a business and a service in UDDI registry. I wrote a class that allow a publisher to delete a service and I got a long exception.
in this class I have two text fields one for business name(BName)
and the other one is for service name(serNM). I used the business name to find the business key, then I used service name with the business key to find service key.I found the service key successfully. Then I try to delete the service using delete_service() method in UDDIProxy class in client package.
this is my java class
import javax.swing.JFrame;
import javax.swing.JLabel;
//java package
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;
import java.util.Vector;
import org.uddi4j.UDDIException;
import org.uddi4j.client.UDDIProxy;
import org.uddi4j.datatype.Name;
import org.uddi4j.datatype.business.BusinessEntity;
import org.uddi4j.response.AuthToken;
import org.uddi4j.response.BusinessDetail;
import org.uddi4j.response.BusinessInfo;
import org.uddi4j.response.BusinessList;
import org.uddi4j.response.DispositionReport;
import org.uddi4j.response.Result;
import org.uddi4j.response.ServiceDetail;
import org.uddi4j.response.ServiceInfo;
import org.uddi4j.response.ServiceList;
import org.uddi4j.util.FindQualifier;
import org.uddi4j.util.FindQualifiers;
import org.uddi4j.datatype.service.BusinessService;
public class DeleteServiceForm extends JFrame{
private JLabel BusinessName,ServiceName;
private JTextField BName,serNm,errorMsg,error1Msg ;
private JButton Exit,clear,delete;
private JComboBox select;
//private String names[] = {"<< Select >> "," Business "," Service "};
public DeleteServiceForm(){
super (" Provider Activity - Delete Service Form ");
ActionEventHandler handler = new ActionEventHandler();
Container cont = getContentPane();
cont.setLayout( new FlowLayout());
BusinessName = new JLabel(" Business Name: ");
ServiceName = new JLabel("Service Name: ");
BName = new JTextField();
serNm = new JTextField();
JPanel panel = new JPanel();
panel.setBorder( new TitledBorder("Delete Service"));
panel.add(BusinessName);
panel.add(BName);
panel.add(ServiceName);
panel.add(serNm);
Icon face = new ImageIcon ("c92e97dea7.jpg");
JButton bb = new JButton("", face);
//JTextField ll = new JTextField(face);
JPanel p = new JPanel();
p.add(bb);
p.setLayout( new GridLayout(1,1));
panel.setLayout( new GridLayout(6,2));
//panelC.setLayout( new GridLayout(6,2));
clear = new JButton(" Clear");
clear.addActionListener(handler);
delete= new JButton (" Delete Service ");
delete.addActionListener(handler);
Exit = new JButton (" Exit ");
Exit.addActionListener(handler);
JLabel label1 = new JLabel("");
JLabel label2 = new JLabel("");
JLabel label3 = new JLabel("");
JLabel label4 = new JLabel("");
JPanel panel2 = new JPanel();
panel2.add(clear);
panel2.add(delete);
panel2.add(Exit);
// panel2.setLayout( new GridLayout (1,3));
JPanel pan = new JPanel();
pan.setLayout( new GridLayout (10,2));
//pan.add(panel_com);
pan.add(p);
pan.add(panel);
pan.add(panel2);
errorMsg = new JTextField();
errorMsg.setVisible( false);
error1Msg = new JTextField();
error1Msg.setVisible( false);
cont.add(pan);
}
public static void main (String args[])
{
DeleteServiceForm exe = new DeleteServiceForm();
exe.setDefaultCloseOperation( EXIT_ON_CLOSE);
exe.setSize (600,600);
exe.setVisible( true);
//System.out.println(BName.getText());
}
//****************************************************************
//Start method to run delete business******************
public void deleteService() {
// Construct a UDDIProxy object
UDDIProxy proxy = new UDDIProxy();
try
{
// Select the desired UDDI server node
proxy.setInquiryURL("http://localhost:8080/juddi/inquiry ");
proxy.setPublishURL("http://localhost:8080/juddi/publish");
// Pass in userid and password registered at the UDDI site
AuthToken token = proxy.get_authToken("juddi","juddi");
//creating vector of Name Object
Vector names = new Vector();
names.add( new Name(BName.getText()));
FindQualifiers findQualifiers = new FindQualifiers();
Vector qualifier = new Vector();
qualifier.add( new FindQualifier("caseSensitiveMatch"));
findQualifiers.setFindQualifierVector(qualifier);
// Find businesses by Business name
// And setting the maximum rows to be returned as 5.
BusinessList businessList = proxy.find_business(names, null, null, null,null,findQualifiers,5);
Vector businessInfoVector = businessList.getBusinessInfos().getBusinessInfoVector();
// Try to delete any businesses with this name. Multiple businesses with the same
// name may have been created by different userids. Delete will fail for businesses
// not created by this id
for( int i = 0; i < businessInfoVector.size(); i++ )
{
BusinessInfo bi = (BusinessInfo)businessInfoVector.elementAt(i);
ServiceList servicelist=proxy.find_service(bi.getBusinessKey(),serNm.getText(),findQualifiers, 10);
Vector serviceInfoVector = servicelist.getServiceInfos().getServiceInfoVector();
for( int n = 0; n < serviceInfoVector.size(); n++ )
{
ServiceInfo serviceInfo = (ServiceInfo)serviceInfoVector.elementAt(n);
// System.out.println("BK"+bi.getBusinessKey());
//System.out.println("SK"+token.getAuthInfoString());
// Have found the matching busines key, delete using the authToken
DispositionReport dr = proxy.delete_service(token.getAuthInfoString(),serviceInfo.getServiceKey());
if( dr.success() )
{
System.out.println("Service successfully deleted");
}
else
{
System.out.println(" Error during deletion of servicen"+
"n operator:" + dr.getOperator() +
"n generic:" + dr.getGeneric() );
Vector results = dr.getResultVector();
for( int j=0; j<results.size(); j++ )
{
Result r = (Result)results.elementAt(j);
System.out.println("n errno:" + r.getErrno() );
if( r.getErrInfo()!=null )
{
System.out.println("n errCode:" + r.getErrInfo().getErrCode() +
"n errInfoText:" + r.getErrInfo().getText());
}
} //for
} //else
} //for
} //for
} //try
// Handle possible errors
catch ( UDDIException e )
{
DispositionReport dr = e.getDispositionReport();
if( dr!=null )
{
System.out.println("UDDIException faultCode:" + e.getFaultCode() +
"n operator:" + dr.getOperator() +
"n generic:" + dr.getGeneric() );
Vector results = dr.getResultVector();
for( int i=0; i<results.size(); i++ )
{
Result r = (Result)results.elementAt(i);
error1Msg.setText("n errno:" + r.getErrno() );
if( r.getErrInfo()!=null )
{
error1Msg.setText("n errCode:" + r.getErrInfo().getErrCode() +
"n errInfoText:" + r.getErrInfo().getText());
}
}
}
e.printStackTrace();
}
// Catch any other exception that may occur
catch( Exception e )
{
e.printStackTrace();
}
}
//*********************************************************************************************************************
private class ActionEventHandler implements ActionListener {
public void actionPerformed( ActionEvent event )
{
if ( event.getSource() == Exit)
System.exit( 0 );
else if ( event.getSource() == delete) {
if (BName.getText().equals("")||serNm.getText().equals(""))
{
JOptionPane.showMessageDialog( null,"Sorry,you have to fill missing fields");
}
else
{
if (JOptionPane.showConfirmDialog(null,"Are You Sure You want to Delete This Service?", "Confirm Massege",
JOptionPane.OK_CANCEL_OPTION)==0)
{
deleteService();
//BName.setVisible(true);
//serNm.setVisible(false);
BName.setText(" ");
serNm.setText(" ");
JOptionPane.showMessageDialog( null," service is deleted successfuly");
}
else
{
BName.setText(" ");
serNm.setText(" ");
}
}
}
else if (event.getSource()== clear){
BName.setText(" ");
serNm.setText(" ");
}
}
}
}//
when I run the class I got the following exception
at org.uddi4j.response.DispositionReport.<init>(DispositionReport.java:2
at org.uddi4j.client.UDDIProxy.delete_service(UDDIProxy.java:1443) at DeleteServiceForm.deleteService(DeleteServiceForm.java:175) at DeleteServiceForm$ActionEventHandler.actionPerformed(DeleteServiceFor 257) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at
java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)
I need a help please
================================================ Afra College of information technology UAE University
Express yourself instantly with MSN Messenger! MSN Messenger Download today it's FREE! --------------------------------------------------------------------- To unsubscribe, e-mail: juddi-user-unsubscribe ws.apache.org For additional commands, e-mail: juddi-user-help ws.apache.org
Don't just search. Find. MSN Search Check out the new MSN Search!
---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-user-unsubscribe ws.apache.org
For additional commands, e-mail: juddi-user-help ws.apache.org
|
[1]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|