[JBossWS] - Re: Single Client, Multiple Service Endpoints
by elcapitan
The closest thing I have found to a solution for this so far is to create different mapping files for each service, i.e. service1-mapping.xml, service2-mapping.xml, etc., and then use the JBoss-proprietary ServiceFactoryImpl class's method createService(URL wsdlDocumentLocation, QName serviceName, URL mappingLocation) to create services on the client side. (The standard javax.xml.rpc.ServiceFactory class doesn't provide a createService method that allows explicit specification of the mapping file.)
The client-side code, then, looks something like the following (this is really just a test, so please excuse the hacky and hard-coded nature of it):
// URLs locating important files.
| URL watchListWSDL = null;
| URL watchListMapping = null;
| URL crawlerWSDL = null;
| URL crawlerMapping = null;
| try {
| watchListWSDL = new URL("http://localhost:8080/crawler/WatchListManager?wsdl");
| watchListMapping = (new File("src/META-INF/watchlist-mapping.xml")).toURL();
| crawlerWSDL = new URL("http://localhost:8080/crawler/CrawlerManager?wsdl");
| crawlerMapping = (new File("src/META-INF/crawler-mapping.xml")).toURL();
| } catch (MalformedURLException e) {
| e.printStackTrace();
| }
|
| // Qualified names of the services.
| QName watchListQName = new QName("http://servercontroller.application.server.webcrawler.thedistillery.com.a...",
| "WatchListManagerInterfaceService");
| QName crawlerQName = new QName("http://servercontroller.application.server.webcrawler.thedistillery.com.a...",
| "CrawlerManagerInterfaceService");
|
| // Services (note that we use the org.jboss.ws.jaxrpc.ServiceFactoryImpl class)
| ServiceFactoryImpl factory = null;
| Service watchListService = null;
| Service crawlerService = null;
| try {
| factory = (ServiceFactoryImpl) ServiceFactory.newInstance();
| watchListService = factory.createService(watchListWSDL, watchListQName, watchListMapping);
| crawlerService = factory.createService(crawlerWSDL, crawlerQName, crawlerMapping);
| } catch (ServiceException se) {
| System.out.println("Couldn't create service");
| }
|
| WatchListManagerInterface wlm = null;
| CrawlerManagerInterface cm = null;
| try {
| wlm = (WatchListManagerInterface) watchListService.getPort(WatchListManagerInterface.class);
| cm = (CrawlerManagerInterface) crawlerService.getPort(CrawlerManagerInterface.class);
| } catch (ServiceException e1) {
| e1.printStackTrace();
| }
|
| // Code that actually uses the services goes here.
This seems to work OK, but I haven't tested it fully and since the services share classes, I'm not sure that it will work out alright in the long run. Any feedback would be extremely welcome!
Thanks guys,
James
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995505#3995505
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995505
18 years
[JBossWS] - wstools ignoring <xsd:choice> ??
by ajay662
In my wsdl there is a choice element somewhere. I am using wstools to generate the java classes from my wsdl, but wstools seems to be ignoring the "xsd:choice" element.
Below are snippets from my wsdl and corresponding generated java classes:
WSDL
<xsd:complexType name="Parameter">
| <xsd:sequence>
| <xsd:element name="name" type="xsd:string">
| </xsd:element>
| <xsd:choice>
| <xsd:element name="scalarValue" type="xsd:string">
| </xsd:element>
| <xsd:element name="arrayValue" type="xsd:boolean">
| </xsd:element>
| </xsd:choice>
| </xsd:sequence>
| </xsd:complexType>
The generated java class
/*
| * JBossWS WS-Tools Generated Source
| *
| * Generation Date: Wed Dec 20 15:18:01 EST 2006
| *
| * This generated source code represents a derivative work of the input to
| * the generator that produced it. Consult the input for the copyright and
| * terms of use that apply to this source code.
| */
|
| package com.covergence.enms.ws.templates;
|
|
| public class Parameter
| {
|
| protected java.lang.String name;
| public Parameter(){}
|
| public Parameter(java.lang.String name){
| this.name=name;
| }
| public java.lang.String getName() { return name ;}
|
| public void setName(java.lang.String name){ this.name=name; }
|
| }
Even though jaxrpc-bindings file look ok
<java-xml-type-mapping>
| <java-type>com.covergence.enms.ws.templates.Parameter</java-type>
| <root-type-qname xmlns:typeNS='http://www.covergence.com/ws/templates'>typeNS:Parameter</root-type-qname>
| <qname-scope>complexType</qname-scope>
| <variable-mapping>
| <java-variable-name>name</java-variable-name>
| <xml-element-name>name</xml-element-name>
| </variable-mapping>
| <variable-mapping>
| <java-variable-name>scalarValue</java-variable-name>
| <xml-element-name>scalarValue</xml-element-name>
| </variable-mapping>
| <variable-mapping>
| <java-variable-name>arrayValue</java-variable-name>
| <xml-element-name>arrayValue</xml-element-name>
| </variable-mapping>
| </java-xml-type-mapping>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995440#3995440
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995440
18 years
[JBossWS] - Re: implementing wsse:UserNameToken
by salex
With [ code ] tags:
"rayymlai" wrote : Further to the last email thread:
|
| 1. A colleague of mine shows me the source code UsernameToken.java from JBossWS 1.0.3 GA. it looks like UsernameToken(Element) method does read the "Username" and "Password" from the SOAP message.
|
| e.g.
|
| | public UsernameToken(Element element) throws WSSecurityException {
| | this.doc = element.getOwnerDocument();
| | String id = element.getAttributeNS(Constants.WSU_NS, Constants.ID);
| | ...
| | Element child = Util.getFirstChildElement(element);
| | if (child == null || ! Constants.WSSE_NS.equals(child.getNamespaceURI()) || ! "Username".equals(child.getLocalName()))
| |
| | throw new WSSecurityException("Username child expected in UsernameToken element");
| | this.username = XMLUtils.getFullTextChildrenFromElement(child);
| | child = Util.getNextSiblingElement(child);
| | ...
| | }
| |
|
| I've tried the following permutation of changes, but I still can't make the WSS 1.0 username token profile work in JBossWS.
|
| 1. in both jboss-wsse-server.xml and jboss-wsse-client.xml, specify , e.g.
|
| | <config>
| | <username />
| | </config>
| |
| 2. in the jboss-wsse*.xml, specify and (derived from the source code UsernameToken.java):
|
| | <config>
| | <Username>manager</Username>
| | <Password>manager</Password>
| | </config>
| |
| 3. Specify username and password in the SOAP stub
| (as per advice from the previous email threads)
|
| - refer to previous reply
|
| 4. Control test - Don't specify anything in the jboss-wsse*.xml. Don't add any user or password in the SOAP stub. This is a control test, to ensure whether or has made any difference.
| - no difference when running the wss samples.
|
|
| Any advice?
|
| Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995333#3995333
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995333
18 years
[JBossWS] - No ClassLoaders found for: org.jboss.ws.server.ServiceEndpoi
by kphilipp
Hi,
if I deploy an artefact built on the base of JBossWS 1.0.3GA and JBoss 4.0.4GA the deployment is okay.
But if I deploy the same artefact built on the base of JBossWS 1.0.4GA and JBoss 4.0.4GA the deployment fails as follows:
12:38:10,995 INFO [EjbModule] Deploying addServiceClientFacade
12:38:11,042 WARN [EjbModule] Could not load the org.jboss.ws.server.ServiceEndpointInterceptor interceptor
java.lang.ClassNotFoundException: No ClassLoaders found for: org.jboss.ws.server.ServiceEndpointInterceptor
at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:212)
at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:511)
at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:405)
...
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
12:38:11,121 INFO [ProxyFactory] Bound EJB Home 'addServiceClientFacade' to jndi 'ejb/addServiceClientFacade'
12:38:11,121 INFO [EJBDeployer] Deployed: file:/D:/Applications/JBoss/4.0.4.GA/server/default/deploy/addService-client.jar
Any hints?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995292#3995292
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995292
18 years