[jboss-user] [JBossWS] - Re: Providing your own wsdl instead of the generated one.

ngtdave do-not-reply at jboss.com
Fri Mar 23 12:31:50 EDT 2007


Just to be clear which versions I'm using:
Boss 4.2.0.CR1
jbossws-1.2.0.GA (build=200703010320)
java 1.5.0_11-b03

Here are the final files.

EchoService.wsdl (note the \<documentation\> tag near the bottom)
<?xml version="1.0" encoding="UTF-8"?>
  | <definitions name='EchoService' targetNamespace='http://echo/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://echo/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
  |  <types>
  |   <xs:schema targetNamespace='http://echo/' version='1.0' xmlns:tns='http://echo/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
  |    <xs:element name='echo' type='tns:echo'/>
  |    <xs:element name='echoResponse' type='tns:echoResponse'/>
  |    <xs:complexType name='echo'>
  |     <xs:sequence>
  |      <xs:element minOccurs='0' name='arg0' type='xs:string'/>
  |     </xs:sequence>
  |    </xs:complexType>
  |    <xs:complexType name='echoResponse'>
  |     <xs:sequence>
  |      <xs:element minOccurs='0' name='return' type='xs:string'/>
  |     </xs:sequence>
  |    </xs:complexType>
  |   </xs:schema>
  |  </types>
  |  <message name='Echo_echo'>
  |   <part element='tns:echo' name='echo'/>
  |  </message>
  |  <message name='Echo_echoResponse'>
  |   <part element='tns:echoResponse' name='echoResponse'/>
  |  </message>
  |  <portType name='Echo'>
  |   <operation name='echo' parameterOrder='echo'>
  |    <input message='tns:Echo_echo'/>
  |    <output message='tns:Echo_echoResponse'/>
  |   </operation>
  |  </portType>
  |  <binding name='EchoBinding' type='tns:Echo'>
  |   <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
  |   <operation name='echo'>
  |    <soap:operation soapAction=''/>
  |    <input>
  |     <soap:body use='literal'/>
  |    </input>
  |    <output>
  |     <soap:body use='literal'/>
  |    </output>
  |   </operation>
  |  </binding>
  |  <service name='EchoService'>
  |   <documentation>Congrats!  You have published your own WSDL!</documentation>
  |   <port binding='tns:EchoBinding' name='EchoPort'>
  |    <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
  |   </port>
  |  </service>
  | </definitions>


web.xml (note <servlet-class> specifies the imple):
<?xml version="1.0" encoding="UTF-8"?>
  | 
  | <web-app 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://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
  |   version="2.4">
  | 
  |   <servlet>
  |     <servlet-name>echo</servlet-name>
  |     <servlet-class>echo.EchoImpl</servlet-class>
  |   </servlet>
  | 
  |   <servlet-mapping>
  |     <servlet-name>echo</servlet-name>
  |     <url-pattern>/*</url-pattern>
  |   </servlet-mapping>
  | 
  | </web-app>

Echo.java (note wsdlLocation added by hand to @WebService)
package echo;
  | 
  | import javax.jws.WebMethod;
  | import javax.jws.WebParam;
  | import javax.jws.WebResult;
  | import javax.jws.WebService;
  | import javax.xml.ws.RequestWrapper;
  | import javax.xml.ws.ResponseWrapper;
  | 
  | 
  | /**
  |  * JBossWS Generated Source
  |  * 
  |  * ...
  |  * JAX-WS Version: 2.0
  |  * 
  |  */
  | @WebService(name = "Echo", targetNamespace = "http://echo/", wsdlLocation="META-INF/wsdl/EchoService.wsdl")
  | public interface Echo {
  | 
  | 
  |     /**
  |      * 
  |      * @param arg0
  |      * @return
  |      *     returns java.lang.String
  |      */
  |     @WebMethod
  |     @WebResult(targetNamespace = "")
  |     @RequestWrapper(localName = "echo", targetNamespace = "http://echo/", className = "echo.Echo_Type")
  |     @ResponseWrapper(localName = "echoResponse", targetNamespace = "http://echo/", className = "echo.EchoResponse")
  |     public String echo(
  |         @WebParam(name = "arg0", targetNamespace = "")
  |         String arg0);
  | 
  | }
  | 

and finally EchoImpl.java (not the portName)
package echo;
  | 
  | @javax.jws.WebService(endpointInterface="echo.Echo", portName="EchoPort")
  | public class EchoImpl implements Echo
  | {
  |    public String echo(String arg0)
  |    {
  |       return arg0;
  |    }
  | }

And for completeness, the war structure
META-INF/
  | META-INF/MANIFEST.MF
  | META-INF/wsdl/
  | META-INF/wsdl/EchoService.wsdl
  | WEB-INF/
  | WEB-INF/classes/
  | WEB-INF/classes/echo/
  | WEB-INF/classes/echo/Echo.class
  | WEB-INF/classes/echo/EchoImpl.class
  | WEB-INF/classes/echo/EchoResponse.class
  | WEB-INF/classes/echo/Echo_Type.class
  | WEB-INF/classes/echo/ObjectFactory.class
  | WEB-INF/classes/echo/package-info.class
  | WEB-INF/web.xml	





View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4031124#4031124

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4031124



More information about the jboss-user mailing list