problem in
itomer Jan 3, 2006 8:22 AMhi, i am new in jbossWS.
i followed the hello world tutorial in wiki, but i could not work it out.
i think it would be some mis-config in my xml descriptor files.
cause i could deploy the war with the example, and see it listed under ws4ee/services.
My steps are as follows:
1. create HelloIF.java, for the interface
package itomer.hello; import java.rmi.Remote; import java.rmi.RemoteException; public interface HelloIF extends Remote{ public String getHello(String name) throws RemoteException; }
2. HelloImp.java
package itomer.hello; public class HelloImp{ public String getHello(String name) { return "Hello" + name + "from web service!!!!"; } }
3. add a in web.xml
<servlet> <servlet-name>HelloWorldWS</servlet-name> <servlet-class>itomer.hello.HelloImp</servlet-class> </servlet> <servlet-mapping> <servlet-name>HelloWorldWS</servlet-name> <url-pattern>/Hello</url-pattern> </servlet-mapping>
4. config.xml
<?xml version="1.0" encoding="UTF-8"?> <configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config"> <service name="HelloService" targetNamespace="urn:FOO" typeNamespace="urn:FOO" packageName="itomer.hello"> <interface name="itomer.hello.HelloIF" /> </service> </configuration>
4. then i use wscomplie to generate the mapping.xml and helloService.wsdl
wscompile -cp "<myclasses>" -d "<destination>" -gen:server -f:rpcliteral -mapping mapping.xml config.xml
it generates two files.
HelloService.xml, under /WEB-INF/wsdl
<?xml version="1.0" encoding="UTF-8"?> <definitions name="HelloService" targetNamespace="urn:FOO" xmlns:tns="urn:FOO" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <types/> <message name="HelloIF_getHello"> <part name="String_1" type="xsd:string"/></message> <message name="HelloIF_getHelloResponse"> <part name="result" type="xsd:string"/></message> <portType name="HelloIF"> <operation name="getHello" parameterOrder="String_1"> <input message="tns:HelloIF_getHello"/> <output message="tns:HelloIF_getHelloResponse"/></operation></portType> <binding name="HelloIFBinding" type="tns:HelloIF"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/> <operation name="getHello"> <soap:operation soapAction=""/> <input> <soap:body use="literal" namespace="urn:FOO"/></input> <output> <soap:body use="literal" namespace="urn:FOO"/></output></operation></binding> <service name="HelloService"> <port name="HelloIFPort" binding="tns:HelloIFBinding"> <soap:address location="REPLACE_WITH_ACTUAL_URL"/></port></service></definitions>
mapping.xml, under /WEB-INF
<?xml version="1.0" encoding="UTF-8"?> <java-wsdl-mapping xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd"> <package-mapping> <package-type>itomer.hello</package-type> <namespaceURI>urn:FOO</namespaceURI> </package-mapping> <package-mapping> <package-type>itomer.hello</package-type> <namespaceURI>urn:FOO</namespaceURI> </package-mapping> <service-interface-mapping> <service-interface>itomer.hello.HelloService</service-interface> <wsdl-service-name xmlns:serviceNS="urn:FOO">serviceNS:HelloService</wsdl-service-name> <port-mapping> <port-name>HelloIFPort</port-name> <java-port-name>HelloIFPort</java-port-name> </port-mapping> </service-interface-mapping> <service-endpoint-interface-mapping> <service-endpoint-interface>itomer.hello.HelloIF</service-endpoint-interface> <wsdl-port-type xmlns:portTypeNS="urn:FOO">portTypeNS:HelloIF</wsdl-port-type> <wsdl-binding xmlns:bindingNS="urn:FOO">bindingNS:HelloIFBinding</wsdl-binding> <service-endpoint-method-mapping> <java-method-name>getHello</java-method-name> <wsdl-operation>getHello</wsdl-operation> <method-param-parts-mapping> <param-position>0</param-position> <param-type>java.lang.String</param-type> <wsdl-message-mapping> <wsdl-message xmlns:wsdlMsgNS="urn:FOO">wsdlMsgNS:HelloIF_getHello</wsdl-message> <wsdl-message-part-name>String_1</wsdl-message-part-name> <parameter-mode>IN</parameter-mode> </wsdl-message-mapping> </method-param-parts-mapping> <wsdl-return-value-mapping> <method-return-value>java.lang.String</method-return-value> <wsdl-message xmlns:wsdlMsgNS="urn:FOO">wsdlMsgNS:HelloIF_getHelloResponse</wsdl-message> <wsdl-message-part-name>result</wsdl-message-part-name> </wsdl-return-value-mapping> </service-endpoint-method-mapping> </service-endpoint-interface-mapping> </java-wsdl-mapping>
5. wrap all of them up with a webservice.xml
webservice.xml
<?xml version="1.0" encoding="UTF-8"?> <webservices xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd" version="1.1"> <webservice-description> <webservice-description-name>HelloService</webservice-description-name> <wsdl-file>WEB-INF/wsdl/HelloService.wsdl</wsdl-file> <jaxrpc-mapping-file>WEB-INF/mapping.xml</jaxrpc-mapping-file> <port-component> <port-component-name>HelloIF</port-component-name> <wsdl-port>HelloIFPort</wsdl-port> <service-endpoint-interface>itomer.hello.HelloIF</service-endpoint-interface> <service-impl-bean> <servlet-link>HelloWorldWS</servlet-link> </service-impl-bean> </port-component> </webservice-description> </webservices>
at last, i deployed them, but i could not find the service info coming up, which is supposed to be something like this:
19:41:22,296 INFO [WSDLFilePublisher] WSDL published to: file:/E:/jboss-4.0.3SP1/server/all/data/wsdl/simple-ws4ee.war/hello.wsdl 19:41:22,765 INFO [AxisService] WSDD published to: E:\jboss-4.0.3SP1\server\all\data\wsdl\simple-ws4ee.war\HelloWorld.wsdd 19:41:24,265 INFO [AxisService] Web Service deployed: http://iscas-2h4lznbhl:8080/simple-ws4ee/exactpath/jse
Any suggestions?
i checked the src in simple-ws4ee.war, i thought it might be the problem with wsdl file. because there are "wsdl" prefix, which are:
<wsdl:message name="getHelloWorldResponse"> <wsdl:part name="getHelloWorldReturn" type="xsd:string"/> </wsdl:message> <wsdl:message name="getHelloWorldRequest"> <wsdl:part name="in0" type="xsd:string"/> </wsdl:message> <wsdl:portType name="HelloWorld">
but according to wscompile tool in jwsdp(in 1.6 and 2.0), it only generate the wsdl files without "wsdl" prefix, and i see wsdl files in jboss example without "wsdl" prefix too. so the "wsdl"prefix may not be the problem.
thanks in advance