Announcement Announcement Module
Collapse
No announcement yet.
holiday Service example Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • holiday Service example

    Hi all,

    I am kinda stuck with getting spring ws to work

    I am able to access the wsdl in the url

    Code:
    http://localhost:8080/tutorial-0.0.1-SNAPSHOT/holiday.wsdl
    In soap UI i am using the endpoint
    Code:
    http://localhost:8080/tutorial-0.0.1-SNAPSHOT/holidayService
    I am getting the error

    Code:
    Mon May 02 14:46:51 NZST 2011:INFO:Got response for [HumanResourceSoap11.Holiday:Request 1] in 7ms (235 bytes)
    
    Mon May 02 14:46:51 NZST 2011:DEBUG:<< "The requested URL /tutorial&#45;0.0.1&#45;SNAPSHOT/holidayService was not found on this server</BODY></HTML>[\r][\n]"
    any help/suggestions

    Thanks
    Thomas

  • #2
    Extra information needed

    Hi, can you post the web.xml?

    Comment


    • #3
      thanks for the response here are the files

      Code:
      <?xml version="1.0" encoding="UTF-8"?>
      <!--
        ~ Copyright 2007 the original author or authors.
        ~
        ~ Licensed under the Apache License, Version 2.0 (the "License");
        ~ you may not use this file except in compliance with the License.
        ~ You may obtain a copy of the License at
        ~
        ~      http://www.apache.org/licenses/LICENSE-2.0
        ~
        ~ Unless required by applicable law or agreed to in writing, software
        ~ distributed under the License is distributed on an "AS IS" BASIS,
        ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        ~ See the License for the specific language governing permissions and
        ~ limitations under the License.
        -->
      
      <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>
      
      	<context-param>
      	<param-name>contextConfigLocation</param-name>
      	<param-value>/WEB-INF/spring-ws-servlet.xml</param-value>
      	</context-param>
      
          <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>
      and my spring-ws-servlet.xml

      Code:
      <?xml version="1.0" encoding="UTF-8"?>
      <!--
        ~ Copyright 2007 the original author or authors.
        ~
        ~ Licensed under the Apache License, Version 2.0 (the "License");
        ~ you may not use this file except in compliance with the License.
        ~ You may obtain a copy of the License at
        ~
        ~      http://www.apache.org/licenses/LICENSE-2.0
        ~
        ~ Unless required by applicable law or agreed to in writing, software
        ~ distributed under the License is distributed on an "AS IS" BASIS,
        ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        ~ See the License for the specific language governing permissions and
        ~ limitations under the License.
        -->
      
      <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>
      
      and the dynamically generated wsdl
      
      	
      	
      	
      
      
      Code:
      <?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:sch="http://mycompany.com/hr/schemas" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://mycompany.com/hr/definitions" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 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-0.0.1-SNAPSHOT/holidayService/"/>
      
          </wsdl:port>
      
        </wsdl:service>
      
      </wsdl:definitions>

      Comment


      • #4
        just to add quickly i tried without

        Code:
        <context-param>
        	<param-name>contextConfigLocation</param-name>
        	<param-value>/WEB-INF/spring-ws-servlet.xml</param-value>
        	</context-param>
        in the web.xml as i read it is already loaded by the org.springframework.ws.transport.http.MessageDispa tcherServlet

        also tried with
        Code:
        <listener>
        		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        	</listener>
        Last edited by tct787; May 2nd, 2011, 06:32 PM.

        Comment


        • #5
          Attempt #1

          Firstly you dont have to do this:
          Code:
          <context-param>
          	<param-name>contextConfigLocation</param-name>
          	<param-value>/WEB-INF/spring-ws-servlet.xml</param-value>
          	</context-param>
          As you have named your servlet "spring-ws" in the web.xml, Spring will automatically attempt to find a file called "spring-ws-servlet.xml" in the WEB-INF folder.

          Secondly, in your spring-ws-servlet.xml try replaced the locationUri:
          Code:
            <sws:dynamic-wsdl id="holiday" portTypeName="HumanResource" locationUri="http://localhost:8080/tutorial-0.0.1-SNAPSHOT/"
                                targetNamespace="http://mycompany.com/hr/definitions">
                  <sws:xsd location="/WEB-INF/hr.xsd"/>
              </sws:dynamic-wsdl>

          Comment


          • #6
            TV Vanavond

            tv-vanavond.nl biedt een programma overzicht waar je kan zien wat je kan verwachten op tv vanavond. TV vanavond, TV gids, Nederlandse TV gids, vanavond op TV.

            -------------
            tv vanavond
            vakantiehuizen Dordogne
            Huis Kopen in Frankrijk
            Online Itunes Store

            Comment


            • #7
              hi changing the location uri didnt fix it


              Code:
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "POST /tutorial-0.0.1-SNAPSHOT/holidayService/ HTTP/1.1[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "Accept-Encoding: gzip,deflate[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "Content-Type: text/xml;charset=UTF-8[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "SOAPAction: ""[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "Host: localhost:8080[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "Content-Length: 669[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://mycompany.com/hr/schemas">[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "   <soapenv:Header/>[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "   <soapenv:Body>[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "      <sch:HolidayRequest>[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "         <!--You may enter the following 2 items in any order-->[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "         <sch:Holiday>[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "            <sch:StartDate>2008-01-01</sch:StartDate>[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "            <sch:EndDate>2008-01-10</sch:EndDate>[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "         </sch:Holiday>[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "         <sch:Employee>[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "            <sch:Number>44</sch:Number>[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "            <sch:FirstName>Thomas</sch:FirstName>[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "            <sch:LastName>TCT</sch:LastName>[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "         </sch:Employee>[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "      </sch:HolidayRequest>[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "   </soapenv:Body>[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:>> "</soapenv:Envelope>"
              Wed May 04 10:21:33 NZST 2011:DEBUG:<< "HTTP/1.1 404 Not found[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:<< "HTTP/1.1 404 Not found[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:<< "MS-Author-Via: DAV[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:<< "DAV: 1,2,<http://www.oracle.com/xdb/webdav/props>[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:<< "Server: Oracle XML DB/Oracle Database[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:<< "Date: Tue, 03 May 2011 22:21:31 GMT[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:<< "Content-Type: text/html; charset=WINDOWS-1252[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:<< "Content-Length: 236[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:<< "[\r][\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:<< "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">[\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:<< "<HTML><HEAD>[\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:<< "<TITLE>404 Not found</TITLE>[\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:<< "</HEAD><BODY><H1>Not found</H1>[\n]"
              Wed May 04 10:21:33 NZST 2011:DEBUG:<< "The requested URL /tutorial-0.0.1-SNAPSHOT/holidayService/ was not found on this server</BODY></HTML>[\r][\n]"
              and the tomcat startup log

              Code:
              4/05/2011 10:39:26 AM org.apache.coyote.http11.Http11Protocol init
              INFO: Initializing Coyote HTTP/1.1 on http-8080
              4/05/2011 10:39:26 AM org.apache.catalina.startup.Catalina load
              INFO: Initialization processed in 274 ms
              4/05/2011 10:39:26 AM org.apache.catalina.core.StandardService start
              INFO: Starting service Catalina
              4/05/2011 10:39:26 AM org.apache.catalina.core.StandardEngine start
              INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
              4/05/2011 10:39:26 AM org.apache.catalina.startup.HostConfig deployDescriptor
              INFO: Deploying configuration descriptor host-manager.xml
              4/05/2011 10:39:26 AM org.apache.catalina.startup.HostConfig deployDescriptor
              INFO: Deploying configuration descriptor manager.xml
              4/05/2011 10:39:27 AM org.apache.catalina.startup.HostConfig deployWAR
              INFO: Deploying web application archive circulo.war
              4/05/2011 10:39:30 AM org.apache.catalina.startup.HostConfig deployWAR
              INFO: Deploying web application archive rwc2011.war
              4/05/2011 10:39:30 AM org.apache.catalina.startup.HostConfig deployWAR
              INFO: Deploying web application archive tutorial-0.0.1-SNAPSHOT.war
              4/05/2011 10:39:31 AM org.apache.catalina.startup.HostConfig deployDirectory
              INFO: Deploying web application directory docs
              4/05/2011 10:39:31 AM org.apache.catalina.startup.HostConfig deployDirectory
              INFO: Deploying web application directory examples
              4/05/2011 10:39:31 AM org.apache.catalina.startup.HostConfig deployDirectory
              INFO: Deploying web application directory ROOT
              4/05/2011 10:39:31 AM org.apache.coyote.http11.Http11Protocol start
              INFO: Starting Coyote HTTP/1.1 on http-8080
              4/05/2011 10:39:31 AM org.apache.jk.common.ChannelSocket init
              INFO: JK: ajp13 listening on /0.0.0.0:8009
              4/05/2011 10:39:31 AM org.apache.jk.server.JkMain start
              INFO: Jk running ID=0 time=0/11  config=null
              4/05/2011 10:39:31 AM org.apache.catalina.startup.Catalina start
              INFO: Server startup in 4424 ms
              4/05/2011 10:40:13 AM org.springframework.web.servlet.FrameworkServlet initServletBean
              INFO: FrameworkServlet 'spring-ws': initialization started
              4/05/2011 10:40:13 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
              INFO: Refreshing WebApplicationContext for namespace 'spring-ws-servlet': startup date [Wed May 04 10:40:13 NZST 2011]; root of context hierarchy
              4/05/2011 10:40:13 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
              INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-ws-servlet.xml]
              4/05/2011 10:40:13 AM org.springframework.ws.soap.addressing.server.AbstractAddressingEndpointMapping afterPropertiesSet
              INFO: Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
              4/05/2011 10:40:13 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
              INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1376afa: defining beans [stubHumanResourceService,holidayEndpoint,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping#0,org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping#0,org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping#0,org.springframework.ws.server.endpoint.adapter.method.dom.DomPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.SourcePayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.dom.Dom4jPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.jaxb.XmlRootElementPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.jaxb.JaxbElementPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.dom.JDomPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.dom.XomPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter#0,org.springframework.xml.xsd.SimpleXsdSchema#0,holiday]; root of factory hierarchy
              4/05/2011 10:40:14 AM org.springframework.ws.soap.saaj.SaajSoapMessageFactory afterPropertiesSet
              INFO: Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol
              4/05/2011 10:40:14 AM org.springframework.web.servlet.FrameworkServlet initServletBean
              INFO: FrameworkServlet 'spring-ws': initialization completed in 845 ms

              Comment


              • #8
                also i am unable to import the wsdl as a project directly supplying the url

                Code:
                Wed May 04 15:35:44 NZST 2011:DEBUG:Getting wsdl component from [http://localhost:8080/tutorial-0.0.1-SNAPSHOT/holiday.wsdl]
                Wed May 04 15:35:44 NZST 2011:ERROR:Failed to load url [http://localhost:8080/tutorial-0.0.1-SNAPSHOT/holiday.wsdl]
                Wed May 04 15:35:44 NZST 2011:ERROR:Loading of definition failed for [http://localhost:8080/tutorial-0.0.1-SNAPSHOT/holiday.wsdl]; org.apache.xmlbeans.XmlException: error: Unexpected element: TAG_END
                Wed May 04 15:35:44 NZST 2011:ERROR:An error occured [error: Unexpected element: TAG_END], see error log for details
                Wed May 04 15:35:44 NZST 2011:ERROR:Error importing wsdl: java.lang.Exception: org.apache.xmlbeans.XmlException: error: Unexpected element: TAG_END
                Wed May 04 15:35:44 NZST 2011:ERROR:An error occured [org.apache.xmlbeans.XmlException: error: Unexpected element: TAG_END], see error log for details
                Wed May 04 15:35:44 NZST 2011:ERROR:An error occured [Error importing wsdl], see error log for details
                so i have saved a local copy on desktop and update the endpoint uri in the request

                Comment

                Working...
                X