Results 1 to 4 of 4

Thread: Holiday Request Tutorial: WSDL retrieved ok, but errors using service

Threaded View

  1. #1
    Join Date
    Aug 2012
    Posts
    4

    Default Holiday Request Tutorial: WSDL retrieved ok, but errors using service

    I'm trying to test out the tutorial in which you create Holiday Requests (http://static.springsource.org/sprin.../tutorial.html).

    I can get it to serve up my WSDL at
    http://localhost:8080/tutorial/holiday.wsdl
    In fact, it will serve up the WSDL
    http://localhost:8080/tutorial/NoMat...e/holiday.wsdl

    In soapUI I add the WSDL to a soapUI project in the usual way via the UI and I get HumanResourceSoap11 with a service endpoint of http://localhost:8080/tutorial/holidayService/ with a single Request. When I submit the Request to the endpoint URL, I get a 404 and "The requested resource () is not available."

    POSTing via Chrome Poster this XML
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <HolidayRequest xmlns="http://mycompany.com/hr/schemas">
    	<Holiday xmlns="http://mycompany.com/hr/schemas">
    		<StartDate>2006-07-03</StartDate>
    		<EndDate>2006-07-07</EndDate>
    	</Holiday>
    	<Employee xmlns="http://mycompany.com/hr/schemas">
    		<Number>5</Number>
    		<FirstName>Jim</FirstName>
    		<LastName>Jones</LastName>
    	</Employee>
    </HolidayRequest>
    to
    http://localhost:8080/tutorial/holidayService/
    http://localhost:8080/tutorial/holid...HolidayRequest
    http://localhost:8080/tutorial/holidayService/Holiday
    http://localhost:8080/tutorial/HolidayRequest
    http://localhost:8080/tutorial/Holiday
    all get me a HTTP 500 and the exception:
    Code:
    com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:application/xml. Is this an error message instead of a SOAP response?
    Here's the usual files I see posted with this issue:
    web.xml
    Code:
    <?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">
    
        <display-name>MyCompany HR Holiday Service</display-name>
    
        <servlet>
            <servlet-name>spring-ws</servlet-name>
            <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
            <init-param>
                <param-name>transformWsdlLocations</param-name>
                <param-value>true</param-value>
            </init-param>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>spring-ws</servlet-name>
            <url-pattern>/*</url-pattern>
        </servlet-mapping>
        
    </web-app>
    spring-ws-servlet.xml:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:sws="http://www.springframework.org/schema/web-services"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    
        <context:component-scan base-package="com.mycompany.hr"/>
    
        <sws:annotation-driven/>
    
        <sws:dynamic-wsdl id="holiday" portTypeName="HumanResource" locationUri="/holidayService/"
                          targetNamespace="http://mycompany.com/hr/definitions">
            <sws:xsd location="/WEB-INF/hr.xsd"/>
        </sws:dynamic-wsdl>
        
    </beans>
    (generated) holiday.wsdl
    Code:
    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    	xmlns:sch="http://mycompany.com/hr/schemas" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    	xmlns:tns="http://mycompany.com/hr/definitions" targetNamespace="http://mycompany.com/hr/definitions">
    	<wsdl:types>
    		<xs:schema xmlns:hr="http://mycompany.com/hr/schemas"
    			xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
    			targetNamespace="http://mycompany.com/hr/schemas">
    			<xs:element name="HolidayRequest">
    				<xs:complexType>
    					<xs:all>
    						<xs:element name="Holiday" type="hr:HolidayType" />
    						<xs:element name="Employee" type="hr:EmployeeType" />
    					</xs:all>
    				</xs:complexType>
    			</xs:element>
    			<xs:complexType name="HolidayType">
    				<xs:sequence>
    					<xs:element name="StartDate" type="xs:date" />
    					<xs:element name="EndDate" type="xs:date" />
    				</xs:sequence>
    			</xs:complexType>
    			<xs:complexType name="EmployeeType">
    				<xs:sequence>
    					<xs:element name="Number" type="xs:integer" />
    					<xs:element name="FirstName" type="xs:string" />
    					<xs:element name="LastName" type="xs:string" />
    				</xs:sequence>
    			</xs:complexType>
    		</xs:schema>
    	</wsdl:types>
    	<wsdl:message name="HolidayRequest">
    		<wsdl:part element="sch:HolidayRequest" name="HolidayRequest"></wsdl:part>
    	</wsdl:message>
    	<wsdl:portType name="HumanResource">
    		<wsdl:operation name="Holiday">
    			<wsdl:input message="tns:HolidayRequest" name="HolidayRequest"></wsdl:input>
    		</wsdl:operation>
    	</wsdl:portType>
    	<wsdl:binding name="HumanResourceSoap11" type="tns:HumanResource">
    		<soap:binding style="document"
    			transport="http://schemas.xmlsoap.org/soap/http" />
    		<wsdl:operation name="Holiday">
    			<soap:operation soapAction="" />
    			<wsdl:input name="HolidayRequest">
    				<soap:body use="literal" />
    			</wsdl:input>
    		</wsdl:operation>
    	</wsdl:binding>
    	<wsdl:service name="HumanResourceService">
    		<wsdl:port binding="tns:HumanResourceSoap11" name="HumanResourceSoap11">
    			<soap:address location="http://localhost:8080/tutorial/holidayService/" />
    		</wsdl:port>
    	</wsdl:service>
    </wsdl:definitions>
    soapUI's request (also tried POSTing this via Chrome Poster, by the way):
    Code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://mycompany.com/hr/schemas">
       <soapenv:Header/>
       <soapenv:Body>
          <sch:HolidayRequest>
             <!--You may enter the following 2 items in any order-->
             <sch:Holiday>
                <sch:StartDate>2006-07-03-</sch:StartDate>
                <sch:EndDate>2006-07-07</sch:EndDate>
             </sch:Holiday>
             <sch:Employee>
                <sch:Number>1</sch:Number>
                <sch:FirstName>Jim</sch:FirstName>
                <sch:LastName>Jones</sch:LastName>
             </sch:Employee>
          </sch:HolidayRequest>
       </soapenv:Body>
    </soapenv:Envelope>
    Random other info:
    Cleaning and packaging via Maven
    Deploying the war file to Tomcat 6
    Using Spring-WS 2.0.4
    Compiled with JDK 1.7.0_05

    Not sure what other details might be needed. I'm probably doing something stupid or missing something minor/obvious, but I've never worked with this stuff before. I scoured the forums already and some people say "Oh, it was just a namespace/URI problem." but they never say which namespace or URI was the problem, how they fixed it, what file(s) they fixed it in, etc, so it hasn't helped much. I hardly changed the tutorial code (if at all), so I am not sure what might be the problem. I can supply the class files if needed, I guess.

    Thanks in advance.
    Last edited by hek8981; Aug 15th, 2012 at 10:12 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •