Hi all,
I am coming back to this topic because it seems that I have the same problem and I cannot
overpass it.
I have successfully deployed a POJO. Very easy.
I am now trying to deploy a WebServiceProvider but I am getting :
Cannot obtain wsdl location
This is my web.xml :
| <?xml version="1.0" encoding="UTF-8"?>
| <web-app>
|
| <servlet-name>Test</servlet-name>
| <servlet-class>test.ws.Test</servlet-class>
|
| <servlet-mapping>
| <servlet-name>Test</servlet-name>
| <url-pattern>/Test</url-pattern>
| </servlet-mapping>
| </web-app>
|
|
| my jboss-web.xml :
|
| | <?xml version="1.0" encoding="ISO-8859-1"?>
| | <!DOCTYPE jboss-web
| | PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN"
| | "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">
| |
| | <jboss-web>
| | <context-root>ws</context-root>
| | </jboss-web>
| |
|
| and this is the code :
|
| | package test.ws;
| |
| |
| | import java.io.ByteArrayInputStream;
| |
| | import javassist.tools.rmi.RemoteException;
| |
| | import javax.jws.WebMethod;
| | import javax.jws.WebParam;
| | import javax.jws.WebResult;
| | import javax.jws.WebService;
| | import javax.jws.soap.SOAPBinding;
| | import javax.xml.transform.Source;
| | import javax.xml.transform.Transformer;
| | import javax.xml.transform.TransformerFactory;
| | import javax.xml.transform.dom.DOMResult;
| | import javax.xml.transform.stream.StreamSource;
| | import javax.xml.ws.Provider;
| | import javax.xml.ws.Service;
| | import javax.xml.ws.ServiceMode;
| | import javax.xml.ws.WebServiceProvider;
| |
| | import org.w3c.dom.Node;
| |
| | @WebServiceProvider
| | @ServiceMode(value = Service.Mode.PAYLOAD)
| | public class Test implements Provider<Source>
| | {
| |
| | public Source invoke(Source source) throws RemoteException {
| | try {
| | DOMResult dom = new DOMResult();
| | Transformer trans =
TransformerFactory.newInstance().newTransformer();
| | trans.transform(source, dom);
| | Node node = dom.getNode();
| | Node root = node.getFirstChild();
| | Node first = root.getFirstChild();
| | int number1 = Integer.decode(first.getFirstChild().getNodeValue());
| | Node second = first.getNextSibling();
| | int number2 = Integer.decode(second.getFirstChild().getNodeValue());
| |
| | return sendSource(number1, number2);
| |
| | } catch(Exception e) {
| | e.printStackTrace();
| | throw new RemoteException("Error in provider endpoint");
| | }
| | }
| |
| | private Source sendSource(int number1, int number2) {
| | int sum = number1+number2;
| | String body =
| | "<ns:querySubscriberResponse
xmlns:ns=\"http://duke.org\"><return>"
| | +sum
| | +"</return></ns:querySubscriberResponse>";
| | Source source = new StreamSource(
| | new ByteArrayInputStream(body.getBytes()));
| | return source;
| | }
| | }
| |
|
| I even tried putting a wsdl inside at
| WEB-INF/wsdl/TestService.wsdl
|
| Where should I put the wsdl so that the deployer can find it ?
| What other artifacts/deployer-descriptors do I need to make it work ?
|
| Thank you in advance !
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4099673#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...