From: K-a-T-a-i *^-^* <am...@ho...> - 2005-11-06 17:06:05
|
Thanks for your help, Farrukh. But I've got another problem. It throws "signSoapMessage failed" error when calling "findOrganizations" or "createOrganization". I'm not sure if I did something wrong. First, after I resolved the "IllegalArgumentException" problem according to your suggestion, I got another error "No instance of X500PrivateCredential found". So I changed my code from ... PasswordAuthentication passwdAuth = new PasswordAuthentication(username,password.toCharArray()); HashSet creds = new HashSet(); creds.add(passwdAuth); connection.setCredentials(creds); to ... HashSet creds = new HashSet(); SecurityUtil securityUtil = new SecurityUtil(); creds.add(securityUtil.aliasToX500PrivateCredential(username, password)); connection.setCredentials(creds); The problem seems to be solved, but another error occured -- "KeyStore file not found C:\Documents and Settings\KaTai\soar\3.0\jaxr-ebxml\security\keystore.jks message.error.create.keystore. Please create one." I've tried to look for the answer in the mailing lists and what I found is the KeyStore should be automatically generated. But I have no idea how to make it being generated. So I copied the file "keystore.jks", which it was generated when I used the registry browser to access the registry, to the directory specified above. After doing all above, I then got a "signSoapMessage failed" problem. Could you please kindly help? Thank you very much. Here is my code -- findOrganizations: Collection findQualifiers = new ArrayList(); findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC); String orgName = ... Collection namePatterns = new ArrayList(); namePatterns.add(orgName); BulkResponse bulkResponse = bqm.findOrganizations(findQualifiers, namePatterns, null, null, null, null); Collection orgs = bulkResponse.getCollection(); Error: javax.xml.registry.RegistryException: javax.xml.registry.RegistryException: javax.xml.registry.JAXRException: signSoapMessage failed org.freebxml.omar.common.QueryManagerSOAPProxy.submitAdhocQuery(QueryManagerSOAPProxy.java:55) org.freebxml.omar.client.xml.registry.DeclarativeQueryManagerImpl.executeQuery(DeclarativeQueryManagerImpl.java:180) org.freebxml.omar.client.xml.registry.DeclarativeQueryManagerImpl.executeQuery(DeclarativeQueryManagerImpl.java:137) org.freebxml.omar.client.xml.registry.DeclarativeQueryManagerImpl.executeQuery(DeclarativeQueryManagerImpl.java:116) org.freebxml.omar.client.xml.registry.BusinessQueryManagerImpl.findOrganizations(BusinessQueryManagerImpl.java:287) entity.PartyManager.searchOrganization(PartyManager.java:104) entity.PartyAction.search(PartyAction.java:145) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:324) org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274) org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(HttpServlet.java:763) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) Thank you once again KaTai >From: Farrukh Najmi <Farrukh.Najmi@Sun.COM> >To: K-a-T-a-i *^-^* <am...@ho...> >CC: ebx...@li... >Subject: Re: [Ebxmlrr-tech] IllegalArgumentException when calling >"findOrganizations" and "setCredentials" >Date: Tue, 01 Nov 2005 08:15:17 -0500 > >K-a-T-a-i *^-^* wrote: >>Hi >> >>I would like to develop my own application for accessing the ebxmlrr >>registry. I've got many problems with my code as I'm quite new to ebxml. >>Please kindly help. Thank you very much. >> >> >>1. It throws an error "java.lang.IllegalArgumentException" when calling >>"findOrganizations". >>My code: >>... >>Collection findQualifiers = new ArrayList(); >>findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC); >>Collection namePatterns = new ArrayList(); >>namePatterns.add(orgName); >>BulkResponse bulkResponse = bqm.findOrganizations(findQualifiers, >>namePatterns, null, null, null, null); >>... >> >>Error: >>java.lang.IllegalArgumentException >> >>com.sun.xml.registry.uddi.bindings_v2.impl.runtime.UnmarshallerImpl.unmarshal(Unknown >>Source) >> >>com.sun.xml.registry.common.util.MarshallerUtil.jaxbUnmarshalObject(Unknown >>Source) >> com.sun.xml.registry.uddi.Processor.processResponseJAXB(Unknown >>Source) >> com.sun.xml.registry.uddi.Processor.processRequestJAXB(Unknown >>Source) >> com.sun.xml.registry.uddi.UDDIMapper.findOrganizations(Unknown >>Source) >> >>com.sun.xml.registry.uddi.BusinessQueryManagerImpl.findOrganizations(Unknown >>Source) >> entity.PartyManager.searchOrganization(PartyManager.java:102) >> entity.PartyAction.search(PartyAction.java:145) >> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> >>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >> >> >>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >> >> java.lang.reflect.Method.invoke(Method.java:324) >> >>org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274) >> >> >>org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194) >> >> >>org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) >> >> >>org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) >> >> >>org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) >> >> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) >> javax.servlet.http.HttpServlet.service(HttpServlet.java:763) >> javax.servlet.http.HttpServlet.service(HttpServlet.java:856) >> >>2. It throws an error "java.lang.IllegalArgumentException" when calling >>"setCredentials". >>My code: >>... >>ConnectionFactory factory = ConnectionFactory.newInstance(); >Hi KaTai, > >First a warm welcome to freebXML Registry community. > >You are accidentally using the wrong JAXR ConnectionFactory because of >above all. > >To creat a ConnectionFactory you should use code like following: > >import org.freebxml.omar.client.xml.registry.util.JAXRUtility; > > /** > * Establishes a connection to a registry. > * > * @param queryUrl the URL of the query registry > * @param publishUrl the URL of the publish registry > */ > public void makeConnection(String queryUrl, String publishUrl) { > ResourceBundle bundle = ResourceBundle.getBundle("JAXRExamples"); > > /* > * Define connection configuration properties. > * For simple queries, you need the query URL. > */ > Properties props = new Properties(); > props.setProperty("javax.xml.registry.queryManagerURL", queryUrl); > > try { > ConnectionFactory factory = JAXRUtility.getConnectionFactory(); > factory.setProperties(props); > connection = factory.createConnection(); > System.out.println("Created connection to registry"); > } catch (Exception e) { > e.printStackTrace(); > > if (connection != null) { > try { > connection.close(); > } catch (JAXRException je) { > } > } > } > } > >Best of luck. >-- >Regards, >Farrukh > > ><< farrukh.najmi.vcf >> |