Java Web Services issue

U

usenetjunkie

Hello,

I'm a Web Services newbie, trying to implement an interface to jUDDI
in Java. I'm running NetBeans 6.0 with GlassFish 2.0 app server.
When I attempt to publish into the registry, I'm getting SOAP
namespace errors. The offending line is:
BulkResponse response = blcm.saveOrganizations(orgs); (see attached
sources)

The DB is Derby-based and happyJUDDI script can see it. I created the
jUDDI DB schema by running the Derby-specific create_database.sql file
I found in juddi-2.0rc5.jar. Went without a hitch.

I'm aware of the comments posted by Jacek WoŸniczak on this mailing
list where in his case it turned out to be a jUDDI username/password
issue, however in my case the username/password combo matches that in
juddi-users.xml file. I found most of the relevant UDDI publishing
code on the Net, and modified it slightly to fit jUDDI. I modified
juddi.properties and juddi-users.xml slightly, left the files where
they were, re-zipped them into a .war, and redeployed on GF2. Any
ideas?

I'm including my Java source files as well as the stack trace.

Thank you very much!

jUDDI's juddi-users.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<juddi-users>
<user userid="sviens" password="svi456" />
<user userid="juddi" password="jud456" />
</juddi-users>


Created connection to registry
Got registry service, query manager, and life cycle manager
Established security credentials
Created org
Created user
Created phone nums
Found classification
Added classification
Created svc
Created bindings
Added bindings
Added svc
http://localhost:8080/jUDDI/publish
SAAJ0306: Namespace Error, Standard Faultcode Client, should be in
SOAP
1.1 Namespace
AxisFault
faultCode:
faultSubcode:
faultString: Fault string, and possibly fault code, not set
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:Fault string, and
possibly fault code, not set
at

org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:
222)
at

org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:
129)
at

org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:
1087)
at

com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:
601)
at

com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:
1772)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl
$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2923)
at

com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:
647)
at

com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:
140)
at

com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
508)
at

com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:
807)
at

com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:
737)
at

com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:
107)
at

com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:
1205)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
$JAXPSAXParser.parse(SAXParserImpl.java:522)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
at

org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext..java:
227)
at
org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at

org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:
796)
at
org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at

org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:
32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:
118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at
org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:1792)
at
org.apache.ws.scout.transport.AxisTransport.send(AxisTransport.java:
64)
at
org.apache.ws.scout.registry.RegistryImpl.execute(RegistryImpl.java:
271)
at

org.apache.ws.scout.registry.RegistryImpl.getAuthToken(RegistryImpl.java:
847)
at

org.apache.ws.scout.registry.BusinessLifeCycleManagerImpl.getAuthToken(BusinessLifeCycleManagerImpl.java:
749)
at

org.apache.ws.scout.registry.BusinessLifeCycleManagerImpl.executeOperation(BusinessLifeCycleManagerImpl.java:
527)
at

org.apache.ws.scout.registry.BusinessLifeCycleManagerImpl.saveOrganizations(BusinessLifeCycleManagerImpl.java:
394)
at producer.uddiPublish.executePublish(uddiPublish.java:173)
at
producer.TranslatorProducer.uddiPublishTest(TranslatorProducer.java:
28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl..java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.sun.enterprise.webservice.InstanceResolverImpl
$1.invoke(InstanceResolverImpl.java:112)
at
com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
at

com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler..java:
257)
at

com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:
93)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
at

com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:
106)
at

com.sun.enterprise.webservice.MonitoringPipe.process(MonitoringPipe.java:
147)
at

com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:
115)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
at

com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:
106)
at

com.sun.enterprise.webservice.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:
218)
at

com.sun.enterprise.webservice.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:
129)
at

com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:
115)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
at
com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:
243)
at
com.sun.xml.ws.transport.http.HttpAdapter
$HttpToolkit.handle(HttpAdapter.java:444)
at
com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:
244)
at

com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:
135)
at
com.sun.enterprise.webservice.JAXWSServlet.doPost(JAXWSServlet.java:
159)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:
738)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:
831)
at

org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:
411)
at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
317)
at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
198)
at

org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter..java:
390)
at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
230)
at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
198)
at

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
288)
at

org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:
271)
at

org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
202)
at

org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:
632)
at

org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:
577)
at
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
206)
at

org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:
632)
at

org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:
577)
at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
571)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:
1080)
at

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
150)
at

org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:
632)
at

org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:
577)
at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
571)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:
1080)
at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:
270)
at

com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:
637)
at

com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:
568)
at

com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:
813)
at com
.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:
339)
at

com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:
261)
at

com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:
212)
at
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:
265)
at

com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:
106)



package producer;

import javax.xml.registry.*;
import javax.xml.registry.infomodel.*;
import java.security.*;
import java.net.*;
import java.util.*;


public class uddiPublish {

Connection connection = null;
/**
* Establishes a connection to a registry.
* @param publishUrl the URL of the publish registry
* @param queryUrl the URL of the query registry
*/
public void makeConnection(String publishUrl, String queryUrl) {
/*
* Define connection configuration properties.
* To publish, you need both the query URL and the
* publish URL.
*/
Properties props = new Properties();
props.setProperty("javax.xml.registry.lifeCycleManagerURL",
publishUrl);
props.setProperty("javax.xml.registry.queryManagerURL",
queryUrl);
// props.setProperty("javax.xml.registry.factoryClass",
"com.sun.xml.registry.uddi.ConnectionFactoryImpl");

props.setProperty("javax.xml.registry.factoryClass",
"org.apache.ws.scout.registry.ConnectionFactoryImpl");

props.setProperty("javax.xml.registry.ConnectionFactoryClass",
"org.apache.ws.scout.registry.ConnectionFactoryImpl");
// props.setProperty("juddi.proxy.transportClass",
"org.apache.juddi.proxy.AxisTransport");
// props.setProperty("juddi.proxy.securityProvider",
"com.sun.net.ssl.internal.ssl.Provider");
// props.setProperty("juddi.proxy.protocolHandler",
"com.sun.net.ssl.internal.www.protocol");

try {
// Create the connection, passing it the
// configuration properties
ConnectionFactory factory = ConnectionFactory.newInstance();
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) {}
}
}
}

/**
* Creates an organization, its classification, and its
* services, and saves it to the registry.
*/
public void executePublish(String username, String password) {
RegistryService rs;
BusinessLifeCycleManager blcm;
BusinessQueryManager bqm;

try {
rs = connection.getRegistryService();
blcm = rs.getBusinessLifeCycleManager();
bqm = rs.getBusinessQueryManager();
System.out.println("Got registry service, query manager, and
life
cycle manager");


// Get authorization from the registry
PasswordAuthentication passwdAuth = new
PasswordAuthentication(username, password.toCharArray());
Set credits = new HashSet();
credits.add(passwdAuth);
connection.setCredentials(credits);

System.out.println("Established security
credentials");


// Create organization name and description
// Replace this information with your organization information
Organization org = blcm.createOrganization("javacourses.com");
InternationalString s =
blcm.createInternationalString("Java training and consulting
services");
org.setDescription(s);

System.out.println("Created org");

// Create primary contact, set name
User primaryContact = blcm.createUser();
PersonName pName = blcm.createPersonName("Qusay H. Mahmoud");
primaryContact.setPersonName(pName);

System.out.println("Created user");

// Set primary contact phone number
TelephoneNumber phoneNum = blcm.createTelephoneNumber();
phoneNum.setNumber("(604) 285-2000");
Collection phoneNums = new ArrayList();
phoneNums.add(phoneNum);
primaryContact.setTelephoneNumbers(phoneNums);

System.out.println("Created phone nums");

// Set primary contact email address
EmailAddress emailAddress =
blcm.createEmailAddress("(e-mail address removed)");
Collection emailAddresses = new ArrayList();
emailAddresses.add(emailAddress);
primaryContact.setEmailAddresses(emailAddresses);

// Set primary contact for organization
org.setPrimaryContact(primaryContact);

// Set classification scheme to NAICS
Collection findQualifiers = new ArrayList();
findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC);
ClassificationScheme cScheme =
bqm.findClassificationSchemeByName(findQualifiers, "ntis-gov:naics");

System.out.println("Found classification");

// Create and add classification
Classification classification = (Classification)
blcm.createClassification(cScheme,
"Computer Training", "61142");
Collection classifications = new ArrayList();
classifications.add(classification);
org.addClassifications(classifications);

System.out.println("Added classification");

// Create services and service
Collection services = new ArrayList();
Service service =
blcm.createService("Buy a Java Course");
InternationalString is = blcm.createInternationalString("This
service allows you to register for a Java course and download its
manuals.");
service.setDescription(is);

System.out.println("Created svc");

// Create service bindings
Collection serviceBindings = new ArrayList();
ServiceBinding binding = blcm.createServiceBinding();
is = blcm.createInternationalString("Service Binding "
+ "Access this services using the given URL.");
binding.setDescription(is);
binding.setAccessURI("http://javacourses.com/register");
serviceBindings.add(binding);

System.out.println("Created bindings");

// Add service bindings to service
service.addServiceBindings(serviceBindings);

System.out.println("Added bindings");

// Add service to services, then add services to organization
services.add(service);
org.addServices(services);

System.out.println("Added svc");

// Add organization and submit to registry
// Retrieve key if successful
Collection orgs = new ArrayList();
orgs.add(org);
BulkResponse response = blcm.saveOrganizations(orgs);
Collection exceptions = response.getExceptions();
if (exceptions == null) {
System.out.println("Organization saved");
Collection keys = response.getCollection();
Iterator keyIter = keys.iterator();
if (keyIter.hasNext()) {
javax.xml.registry.infomodel.Key orgKey =
(javax.xml.registry.infomodel.Key) keyIter.next();
String id = orgKey.getId();
System.out.println("Organization key is " + id);
org.setKey(orgKey);
}
} else {
Iterator excIter = exceptions.iterator();
Exception exception = null;
while (excIter.hasNext()) {
exception = (Exception) excIter.next();
System.err.println("Exception on save: " +
exception.toString());
}
}
} catch (Exception e) {
e.printStackTrace();
if (connection != null) {
try {
connection.close();
} catch (JAXRException je) {
System.err.println("Connection close failed");
}
}
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,795
Messages
2,569,644
Members
45,357
Latest member
RuthEsteve

Latest Threads

Top