Advertisement :
   Log In    OR    Register  
  Topics :  
RMI Example

Home >>> Spring Tutorials >>> Spring WebService >>> Example Code Discussed
Struts Tutorials:
Struts2 Tag CheckBoxList
, Checkbox, Iterator, IF
Struts2 Tag Library Example Struts2 Tiles Example Struts2 Tiles I18N Example Struts2 Questions Struts Tiles I18N Example Struts Eclipse MVC Struts2 Tags Struts2 Example and Tutorial Struts MVC Struts2 Validation
Hibernate Tutorials: Hibernate Case Study Class Hierarchy Persist Example Using Hibernate Interceptor Hibernate Questions with Answer Hibernate Many-to-Many Mapping Example Hibernate one-to-many Mapping Example Hibernate and ORM tools Spring Hibernate Example Hibernate SessionFactory Example Hibernate Mapping Class Hierarchy Hibernate Questions Hibernate SessionFactory Questions Spring Hibernate Example: Spring Hibernate Case Study

Written By : ISHTEK
Title :
Spring Reflection
Description : POC Idea example code
More...


Written By : ISHTEK
Title :
Spring singleton
Description : Spring Container Example
More...


Written By : ISHTEK
Title :
Spring Features Updates News
Description : Bringing To Page
More...


Written By : ISHTEK
Title :
Spring Service
Description : Web Service Example
More...


Written By : ISHTEK
Title :
Spring WebService
Description : Example Code Discussed
More...


Written By : Amit
Title :
Spring Web MVC
Description : Example code discussed
More...


Written By : ISHTEK
Title :
Spring Remote Stateless SessionBean
Description : Calling SessionBean Example code
More...

Tags/Keywords : Spring Web Service, webservice, spring webservice, example, code
Author : ISHTEK
Date (Year/Month/Date): 2010-06-13 Web Service Example code using Spring WS Framework

Please be informed that NONE of the design/code/matter from this page is claiming to be some
sort of best practice and we DO NOT expect any of our visitor/reader of this page to assume
this as some sort of best practice for any context and should not be using this as it is
without appropriate evaluation.
This page intends only to provide bits and pieces of known ways  for doing some sort of example
and may not be fit for any other purpose.

In spite of all precautions taken to provide accurate and avoid any typo in these pages,
there might be some issues like grammatical mistakes and typo being observed in these pages,
We extend our sincerest apologies for the same.


Using Spring Framework and creating a simple to understand web service application that can be deployed onto Tomcat web server. And also writing a test harness class for invoking this web service using Spring Framework. For this example to work, environment needed are as follows:
  • Spring ws version 1.5.8
  • Java version 6.0
  • Tomcat version 6.0
  • Eclipse 3.5.1
  • (Please be informed that this example is tested only using above version of software, don't know whether it will work or not in any other version, but one can try and refer official Spring documentation for version compatibility related aspects.) Initially I started with referring to the documentation supplied with Spring WS distribution files. And after having enough knowledge on the basics and technology stack related aspects, started with putting some thought and coming up with a very easy to understand (that is what I think so), case study as follows: Suppose there is a supplier (I will name it as SUPL) and a warehouse company (I will name it as WAREINC). Both these entities are going to interact with each other irrespective of operating environment and location these two entities are having as far as their application technology stack is concerned. This means SUPL can have an application that is using command line application and the WAREINC is having a web based application. SUPL wants to query WAREINC for details on storage capacity of certain items. The method name could be as simple as itemStatus(ItemRequest itemRequest) and the return type could be List of following:
    String itemNumber
    int    quantity
    Date   asOfDate
    
    So in this example there are basically two value objects such as ItemRequest and ItemResponse. ItemRequest is having the itemNumber of type String as shown below: ItemRequest.java
    package com.wareinc.ws;
    
    public class ItemRequest {
      private String itemNumber;
    
      public String getItemNumber() {
    	return itemNumber;
      }
    
      public void setItemNumber(String itemNumber) {
    	this.itemNumber = itemNumber;
      }
    }
    
    And the response to the web sevice call will return another value object of type ItemResponse, as shown below: ItemResponse.java
    package com.wareinc.ws;
    
    import java.util.Date;
    
    public class ItemResponse {
      private String itemNumber;
      private int quantity;
      private Date asOfDate;
      public String getItemNumber() {
    	return itemNumber;
      }
      public void setItemNumber(String itemNumber) {
    	this.itemNumber = itemNumber;
      }
      public int getQuantity() {
    	return quantity;
      }
      public void setQuantity(int quantity) {
    	this.quantity = quantity;
      }
      public Date getAsOfDate() {
    	return asOfDate;
      }
      public void setAsOfDate(Date asOfDate) {
    	this.asOfDate = asOfDate;
      }
    }
    
    The so called business service for this example, is also known as ItemService.java is an interface with an implementation class as ItemServiceImpl, as shown below: ItemService.java
    package com.wareinc.ws;
    
    public interface ItemService {
      public ItemResponse itemStatus(ItemRequest itemRequest);
    }
    
    And ItemServiceImpl.java
    package com.wareinc.ws;
    
    import java.util.Calendar;
    
    public class ItemServiceImpl implements ItemService {
    
    	public ItemResponse itemStatus(ItemRequest itemRequest) {
            
    		//This method can have some call
    		//to the business tier of this example
    		//and do some thing useful.
    		//as of now this is just returning some
    		//hard code values for those fields.
    		ItemResponse itmResp = new ItemResponse();
            itmResp.setItemNumber("ITM001");
            itmResp.setQuantity(20);
            Calendar cd = Calendar.getInstance();
            cd.set(2010, 01, 03);
            itmResp.setAsOfDate(cd.getTime());
    		return itmResp;
    	}
    }
    
    While using Spring Framework web service, There needs to be having an endpoint, in this case I have used a sub class of org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint ItemServiceEndPoint.java
    package com.wareinc.ep;
    
    import org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint;
    
    import com.wareinc.ws.ItemRequest;
    import com.wareinc.ws.ItemService;
    
    public class ItemServiceEndPoint extends AbstractMarshallingPayloadEndpoint {
        public static final String NAMESPACE_URI_VALUE = "http://ws.wareinc.com";
        public static final String NS_RESPONSE_NAME = "itemStatusResponse";
        private ItemService itemService;
    	public void setItemService(ItemService itemService) {
    		this.itemService = itemService;
    	}
    	@Override
    	protected Object invokeInternal(Object arg0) throws Exception {
    		System.out.println("***** "+(ItemRequest)arg0);
    		
    		return itemService.itemStatus((ItemRequest)arg0);
    	}
    }
    
    This namespace uri value should be same as the target Namespace valu from the WSDL definition file as shown below: item.wsdl
    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
                      xmlns:ns="http://ws.wareinc.com" 
                      xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" 
                      xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
                      xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                      xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
                      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
                      targetNamespace="http://ws.wareinc.com">
        <wsdl:types>
            <xs:schema attributeFormDefault="qualified" 
                       elementFormDefault="qualified" 
                       targetNamespace="http://ws.wareinc.com/xsd">
                <xs:complexType name="ItemRequest">
                    <xs:sequence>
                        <xs:element minOccurs="0" name="itemNumber" 
                            nillable="true" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
                <xs:complexType name="ItemResponse">
                    <xs:sequence>
                        <xs:element minOccurs="0" name="asOfDate" 
                            nillable="true" type="xs:date"/>
                        <xs:element minOccurs="0" name="itemNumber" 
                            nillable="true" type="xs:string"/>
                        <xs:element minOccurs="0" name="quantity" 
                            type="xs:int"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:schema>
            <xs:schema xmlns:ax22="http://ws.wareinc.com/xsd" 
                       attributeFormDefault="qualified" 
                       elementFormDefault="qualified" 
                       targetNamespace="http://ws.wareinc.com">
                <xs:import namespace="http://ws.wareinc.com/xsd"/>
                <xs:element name="itemStatus">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element minOccurs="0" name="arg0" 
                                        nillable="true" 
                                        type="ax22:ItemRequest"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="itemStatusResponse">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element minOccurs="0" name="return" 
                                nillable="true" type="ax22:ItemResponse"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:schema>
        </wsdl:types>
        <wsdl:message name="itemStatusRequest">
            <wsdl:part name="parameters" element="ns:itemStatus"/>
        </wsdl:message>
        <wsdl:message name="itemStatusResponse">
            <wsdl:part name="parameters" element="ns:itemStatusResponse"/>
        </wsdl:message>
        <wsdl:portType name="ItemServicePortType">
            <wsdl:operation name="itemStatus">
                <wsdl:input message="ns:itemStatusRequest" 
                            wsaw:Action="urn:itemStatus"/>
                <wsdl:output message="ns:itemStatusResponse" 
                             wsaw:Action="urn:itemStatusResponse"/>
            </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="ItemServiceSoap11Binding" 
                         type="ns:ItemServicePortType">
            <soap:binding transport="http://schemas.xmlsoap.org/soap/http" 
                          style="document"/>
            <wsdl:operation name="itemStatus">
                <soap:operation soapAction="urn:itemStatus" 
                                   style="document"/>
                <wsdl:input>
                    <soap:body use="literal"/>
                </wsdl:input>
                <wsdl:output>
                    <soap:body use="literal"/>
                </wsdl:output>
            </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="ItemService">
            <wsdl:port name="ItemServiceHttpSoap11Endpoint" 
                       binding="ns:ItemServiceSoap11Binding">
                <soap:address 
                    location="http://localhost:8080/itemservice/item.wsdl"/>
            </wsdl:port>
        </wsdl:service>
    </wsdl:definitions>
    
    This WSDL definition file is one out of many possible ways one can write, one can have a separate XSD file, and refer that in WSDL file, but in this example I have added user-defined element and data type in the same WSDL definition itself. In this example I shall be using MessageDispatcherServlet from Spring Framework. So the web.xml file goes as follows: web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
       http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
       version="2.5"> 
      <servlet>
        <servlet-name>Spring-WS-Servlet</servlet-name>
    	<servlet-class>
    	  org.springframework.ws.transport.http.MessageDispatcherServlet
    	</servlet-class>
      </servlet>
      <servlet-mapping>
        <servlet-name>Spring-WS-Servlet</servlet-name>
    	<url-pattern>/*</url-pattern>
      </servlet-mapping>
    </web-app>
    
    As the MessageDispatcherServlet is configured with a servlet name as "Spring-WS-Servlet", so I needed to create another Spring Framework servlet XML configuration file as follows: Spring-WS-Servlet-servlet.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
        <bean id="itemService" class="com.wareinc.ws.ItemServiceImpl"/>
          <bean id="castorMarshaller" 
                class="org.springframework.oxm.castor.CastorMarshaller" >
          <property name="mappingLocation" value="classpath:mapping.xml" />
          </bean>
           <bean id="itemEndPoint" class="com.wareinc.ep.ItemServiceEndPoint">
             <property name="itemService" ref="itemService"/>
             <property name="marshaller" ref="castorMarshaller"/>
             <property name="unmarshaller" ref="castorMarshaller"/>
           </bean>
           <bean id="itemEndPointMapping" 
           class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
             <property name="defaultEndpoint" ref="itemEndPoint"/>
           </bean>
           <bean id="item" 
                 class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
             <constructor-arg value="/WEB-INF/wsdl/item.wsdl"/>
           </bean>
    </beans>
    
    This file will be automatically read by Spring Framework and appropriate endpoint and endpoint mapping can be configured. Bean "item" is going to read item.wsdl file from the folder and will be available for use. org.springframework.oxm.castor.CastorMarshaller is used for providing marshaller and unmarshaller support to the Spring Web service Framework. For this appropriately created mapping.xml file is provided under WEB-INF/classes folder, mapping.xml
    <?xml version="1.0"?>
    <!DOCTYPE mapping PUBLIC 
               "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
               "http://castor.org/mapping.dtd">
    <mapping>                         
    <class name="com.wareinc.ws.ItemResponse">
       <map-to xml="item"/>
    
       <field name="itemNumber" type="string">
          <bind-xml name="itemNumber" node="element"/>
       </field>
    
       <field name="quantity" type="integer">
          <bind-xml name="quantity" node="element"/>
       </field>
       <field name="asOfDate" type="date">
          <bind-xml name="asofdate" node="element"/>
       </field>
    </class>
    
    <class name="com.wareinc.ws.ItemRequest">
      <map-to xml="itemStatus"/>
       <field name="itemNumber" type="string">
          <bind-xml name="itemNumber" location="arg0" 
                                node="element"/>
       </field>
    </class>
    </mapping>
    
    In order to understand the way Castor Framework Mapping works, please visit URL as mentioned in the reference section below. List of Jar files used in this example (under WEB-INF/lib folder):
  • castor-1.2.jar
  • commons-logging-1.1.1.jar
  • log4j-1.2.15.jar
  • org.springframework.aop-3.0.0.RELEASE.jar
  • org.springframework.asm-3.0.0.RELEASE.jar
  • org.springframework.aspects-3.0.0.RELEASE.jar
  • org.springframework.beans-3.0.0.RELEASE.jar
  • org.springframework.context-3.0.0.RELEASE.jar
  • org.springframework.context.support-3.0.0.RELEASE.jar
  • org.springframework.core-3.0.0.RELEASE.jar
  • org.springframework.expression-3.0.0.RELEASE.jar
  • org.springframework.web-3.0.0.RELEASE.jar
  • org.springframework.web.servlet-3.0.0.RELEASE.jar
  • spring-ws-1.5.8-all.jar
  • Of course along with all the required License files. All these files are put in appropriate places/folders under a web application "itemservice" (refer to the SOAP Address location in WSDL file) <soap:address location="http://localhost:8080/itemservice/item.wsdl"/> After starting the web server successfully, it is needed to check the WSDL URL by using the complete URL from the WSDL file on browser's addess bar. One should see the complete WSDL definitions with XML tags on browser, to make sure everything is okay till this point. So far the WAREINC(so to say company in this example) has got its web service up and running. For the SUPL (so to say another company in this example), would be writing a client to test whether it is able to invoke the remote web service by using WSDL URL from the WAREINC. For the sack of simplicity, I have written a test client as follows: ItemServiceTestClient.java
    package test.client;
    
    import javax.xml.transform.Source;
    import javax.xml.transform.stream.StreamSource;
    
    import org.springframework.ws.client.core.support.WebServiceGatewaySupport;
    import org.springframework.xml.transform.StringResult;
    
    public class ItemServiceTestClient extends WebServiceGatewaySupport {
      public ItemServiceTestClient() {
          try {
              setDefaultUri("http://localhost:8080/itemservice/item.wsdl");
              Source requestSource = new StreamSource("src/itemrequest.xml");
              StringResult resultStr = new StringResult();
              getWebServiceTemplate().
              sendSourceAndReceiveToResult(requestSource, resultStr);
              System.out.println(resultStr);
          } catch (Exception ex) {
              ex.printStackTrace();
          }
      }
      public static void main(String args[]){
          new ItemServiceTestClient();
      }
    }
    
    This client is using the WebServiceGatewaySupport from Spring-WS Framework api, just to make thinks quick enough to test. defaultUri is set as the complete URL of the WSDL definition from web server and the XML file as the payload along with the SOAP request. itemrequest.xml
    <itemStatus>
       <arg0>
          <itemNumber>25</itemNumber>
       </arg0>
    </itemStatus>
    
    After invoking this web service, the StringResult returned is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <item>
     <itemNumber>ITM001</itemNumber>
     <quantity>20</quantity>
     <asofdate>
         2010-02-03T16:30:49.406+05:30
     </asofdate>
    </item>
    
    This is how I could able to pass XML string to (as request) and from (as response) web service using Spring WS Framework. References: http://castor.org/xml-mapping.html http://static.springsource.org/spring-ws/sites/1.5/reference/html/oxm.html
    
    
    	

    Commented By ->
    Amit
    You can use Apache Axis 2 with the WSDL URL for creating
    wrapper class files to be used from the client code.
    
    I think, this is much better than using Raw SOAP XML file
    as request.
    
    This is just a thought

    Commented By ->
    ISHTEK
    Hello,
    
    I have modified the test client from this example in order
    to use objects of ItemRequest and get back in return 
    object ItemResponse objects, this way I just tried not to use
    raw XML string as request and response, instead use Castor's
    Marshaller and UnMarshaller functionalities.
    
    Hope this helps.
    
    
    package test.client;
    
    import java.util.ResourceBundle;
    
    import javax.xml.transform.Source;
    import javax.xml.transform.stream.StreamSource;
    
    import org.springframework.core.io.ClassPathResource;
    import org.springframework.core.io.FileSystemResource;
    import org.springframework.oxm.castor.CastorMarshaller;
    import org.springframework.ws.client.core.WebServiceTemplate;
    import org.springframework.ws.client.core.support.WebServiceGatewaySupport;
    import org.springframework.xml.transform.StringResult;
    
    import com.wareinc.ws.ItemRequest;
    import com.wareinc.ws.ItemResponse;
    /**
    * Modified by ISHTEK
    */
    public class ItemServiceTestClient extends WebServiceGatewaySupport {
      public ItemServiceTestClient() {
      try {
        //one can use Spring core for
        //injecting defaultUri, CastorMarshaller etc.
        //but for now I have instantiated these separately
        //without using Spring's Application Context.
    
        setDefaultUri("http://localhost:8080/itemservice/item.wsdl");
        CastorMarshaller castorM = new CastorMarshaller();
        castorM.setMappingLocation(
                new FileSystemResource
           ("E:/Spring-Webservice-Example/WAREINC/src/mapping.xml"));
        setMarshaller(castorM);
        setUnmarshaller(castorM);
        castorM.afterPropertiesSet();
    
        ItemRequest requestPayload = new ItemRequest();
        requestPayload.setItemNumber("100");
    
        ItemResponse itmResp = (ItemResponse) getWebServiceTemplate()
    			   .marshalSendAndReceive(requestPayload);
    
        System.out.println(itmResp.getItemNumber()+"  "
    			     +itmResp.getQuantity()+"  "
    			     +itmResp.getAsOfDate());
      } catch (Exception ex) {
    	  ex.printStackTrace();
      }
      }
      public static void main(String args[]){
    	  new ItemServiceTestClient();
      }
    }
    

    Commented By ->
    ISHTEK
    I would like to add to this example, some sort of logging
    functionality whereby there will console output of Request
    and Response payload.
    This can be achieved by using interceptors such as 
    org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor
    
    This interceptor needs to be configured in the Spring-WS-Servlet-servlet.xml
    from this example, and the local reference needs to be included
    in the bean tag corresponding to the PayloadRootQNameEndpointMapping.
    
    So the modified version of the Spring-WS-Servlet-servlet.xml file
    is as follows:
    
    
    ....
    ....
    <bean id="loggingInterceptor" 
         class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
    <bean id="itemEndPointMapping" 
        class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
     <property name="defaultEndpoint" ref="itemEndPoint"/>
             <property name="interceptors">
               <list>
                 <ref local="loggingInterceptor"/>
               </list>
             </property>
    </bean>
    ....
    ....
    
    And of course one would require appropriate log4j.properties file under WEB-INF/classes folder with the desire to print only those request and response by filtering logger for the package org.springframework.ws.server.endpoint my example log4j.properties file is as follows:
    log4j.rootLogger=WARN, log
    log4j.logger.org.springframework.ws.server.endpoint=DEBUG
    log4j.appender.log=org.apache.log4j.ConsoleAppender
    log4j.appender.log.layout=org.apache.log4j.PatternLayout
    log4j.appender.log.layout.ConversionPattern=[%c] - %m%n
    
    So this can be one of the many ways one can use many different interceptors like XML request and response Transformation interceptors, security interceptors etc. By running the same example, I could see XML payload, both request and response shows up on server console as output. Please do write to me about how you feel this writing is, Is it useful or needs improvement, please use the comment section below.

    Commented By ->
    ISHTEK
    I have tried separating the type definition onto
    another XSD file, as follows:
    
    item.xsd
    
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema attributeFormDefault="qualified" 
    	   elementFormDefault="qualified" 
    	   targetNamespace="http://ws.wareinc.com/xsd">
        <xs:complexType name="ItemRequest">
    	<xs:sequence>
    	    <xs:element minOccurs="0" name="itemNumber" 
    	                nillable="true" type="xs:string"/>
    	</xs:sequence>
        </xs:complexType>
        <xs:complexType name="ItemResponse">
    	<xs:sequence>
    	    <xs:element minOccurs="0" name="asOfDate" 
    	                nillable="true" type="xs:date"/>
    	    <xs:element minOccurs="0" name="itemNumber" 
    	                nillable="true" type="xs:string"/>
    	    <xs:element minOccurs="0" name="quantity" type="xs:int"/>
    	</xs:sequence>
        </xs:complexType>
        <xs:element name="itemStatus">
    	<xs:complexType>
    	    <xs:sequence>
    		<xs:element minOccurs="0" name="arg0" 
    			    nillable="true" type="urn:ItemRequest"/>
    	    </xs:sequence>
    	</xs:complexType>
        </xs:element>
        <xs:element name="itemStatusResponse">
    	<xs:complexType>
    	    <xs:sequence>
    		<xs:element minOccurs="0" name="return" 
    			    nillable="true" type="urn:ItemResponse"/>
    	    </xs:sequence>
    	</xs:complexType>
        </xs:element>
    </xs:schema>
    
    So now the item.wsdl file will have to have a namespace, as I have used the same namespace as "ax22", and this will refer to the namespace of the XSD file: Now the modified item WSDL file would look like as follows: item.wsdl
    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
                      xmlns:ns="http://ws.wareinc.com" 
                      xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" 
                      xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
                      xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                      xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
                      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    		  xmlns:ax22="http://ws.wareinc.com/xsd"
                      targetNamespace="http://ws.wareinc.com">
        <wsdl:types>
        </wsdl:types>
        <wsdl:message name="itemStatusRequest">
            <wsdl:part name="parameters" element="ns:itemStatus"/>
        </wsdl:message>
        <wsdl:message name="itemStatusResponse">
            <wsdl:part name="parameters" element="ns:itemStatusResponse"/>
        </wsdl:message>
        <wsdl:portType name="ItemServicePortType">
            <wsdl:operation name="itemStatus">
                <wsdl:input message="ns:itemStatusRequest" 
                            wsaw:Action="urn:itemStatus"/>
                <wsdl:output message="ns:itemStatusResponse" 
                             wsaw:Action="urn:itemStatusResponse"/>
            </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="ItemServiceSoap11Binding" 
                      type="ns:ItemServicePortType">
            <soap:binding transport="http://schemas.xmlsoap.org/soap/http" 
                          style="document"/>
            <wsdl:operation name="itemStatus">
                <soap:operation soapAction="urn:itemStatus" 
    	                    style="document"/>
                <wsdl:input>
                    <soap:body use="literal"/>
                </wsdl:input>
                <wsdl:output>
                    <soap:body use="literal"/>
                </wsdl:output>
            </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="ItemService">
            <wsdl:port name="ItemServiceHttpSoap11Endpoint" 
                       binding="ns:ItemServiceSoap11Binding">
                <soap:address 
    	          location="http://localhost:8080/itemservice/item.wsdl"/>
            </wsdl:port>
        </wsdl:service>
    </wsdl:definitions>
    
    I just tried to give this example WSDL file a more simpler look by moving all the custom type definitions moved from the original WSDL file, that's all, rest of the things are tested and working fine in my local test environment. The modified section in item.wsdl file are highlighted in bold above.
    Please write your Comment on this Matter
    (This will be visible if found suitable):
    Name: *
    Email (will not be displayed): *
    Matter: *
    21,38
    Enter bigger number from above :*
    Home >>> Spring Tutorials >>> Spring WebService >>> Example Code Discussed
    Visitor/User referred related external URL:
    (Visible upon review and approved by this site Administrator)
    
    Referred By Name *:
    Resource URL *: (e.g, URL should be starting with http://www.-----.---)
     
    Resource Short Description *:
    33,15
    Enter bigger number from above : *

    Please log in to add or reply to any matter<- requires login
    Log in or Register
    Copyright © 2008-2010, Interview-Questions-Tips-Forum, All Rights Reserved.
    CONTACT    PRIVACY POLICY    DISCLAIMER
     
    
    Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    Other names may be trademarks of their respective owners
    
    This web site's Terms of Use and Disclaimer :
    
    This web site provides some of the information about various technologies, example code, tips, tutorials etc. Like any printed materials,
    content of these pages may become out of date over a period of time. Therefore all visitor/users of this web site are requested/advised
    to refer to the originating parties/sources for the latest changes and happenings for detailed information. This information is not
    intended to be a substitute for the original reference provided by the originating parties/sources. These examples with source code or
    without source code, have not been thoroughly tested under all conditions. Interview-questions-tips-forum.net therefore, cannot guarantee
    or imply reliability of these example source code or programs.
    
    By accessing and using this website in any ways, including, without limitation, browsing the website pages, using any information, using
    any content and/or downloading any materials, you agree to and are bound by the terms of use described in this page and Usage Terms and Conditions.
    If you do not agree to all of the terms and conditions contained in the terms of use described in this page and
    Usage Terms and Conditions, do not use this website in any manner. If you are using the website on behalf of your
    employer, you represent that you are authorized to accept these Terms of Use on your employer's behalf.
    
    All Trademarks are property of their respective owner. Appropriate measure is being taken for providing accurate and up-to-date
    information but like any printed materials, these blog(s)/contents may eventually be outdated one day, so if you are using any of these
    information, please refer original content/documentation from respective sources. And under no circumstances shall the Author of these
    contents and/or this web site be liable for any loss, damage, expense incurred or suffered which is claimed to have occurred because of
    usage of the contents of this web site. If you have any questions/queries/feedback/suggestions then please write to this web site owner
    at contact.