Announcement Announcement Module
Collapse
No announcement yet.
No adapter for endpoint Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • No adapter for endpoint

    Good morning.
    I'm developing a web services using spring 2.5.6 and JAXB.
    I have read all post about this topic in forum, but I can't find a solution (I'm a newbee).
    In code, (inside classes) I can see java.lang.IllegalStateException:, but in console shows me:
    Code:
    Exception in thread "main" org.springframework.ws.soap.client.SoapFaultClientException: No adapter for endpoint [
    My files:
    Spring-ws-servlet
    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"
    
    	xsi:schemaLocation="http://www.springframework.org/schema/beans 
    
    
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
    
    	<bean id="weatherService" class="com.apress.springrecipes.weather.WeatherServiceImpl" />
    
    	<bean
    		class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping" />
    
    	<bean
    		class="org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter">
    		<property name="marshaller" ref="marshaller" />
    		<property name="unmarshaller" ref="marshaller" />
    	</bean>
    	<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb1Marshaller">
    		<property name="contextPath">
    			<value>com.apress.springrecipes.weather.schemas</value>
    		</property>
    	</bean>
    
    	<bean id="temperatureEndpoint"
    		class="com.apress.springrecipes.weather.TemperatureMarshallingEndpoint">
    		<property name="weatherService" ref="weatherService" />
    	</bean>
    
    	<bean id="temperature"
    		class="org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition">
    		<property name="builder">
    			<bean
    				class="org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder">
    				<property name="schema" value="/WEB-INF/xsd/weather.xsd" />
    				<property name="portTypeName" value="Weather" />
    				<property name="locationUri" value="http://localhost:8083/admision/services" />
    				<property name="targetNamespace"
    					value="http://springrecipes.apress.com/weather/schemas" />
    			</bean>
    		</property>
    	</bean>
    </beans>
    my XSD file:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    	targetNamespace="http://springrecipes.apress.com/weather/schemas"
    	xmlns="http://springrecipes.apress.com/weather/schemas">
    	<xs:element name="GetTemperaturesRequest">
    		<xs:complexType>
    			<xs:sequence>
    				<xs:element name="city" type="xs:string" />
    				<xs:element maxOccurs="5" minOccurs="1" name="date" type="xs:date" />
    			</xs:sequence>
    		</xs:complexType>
    	</xs:element>
    	<xs:element name="GetTemperaturesResponse">
    		<xs:complexType>
    			<xs:sequence>
    				<xs:element maxOccurs="5" minOccurs="1" name="TemperatureInfo">
    					<xs:complexType>
    						<xs:sequence>
    							<xs:element name="min" type="xs:float" />
    							<xs:element name="max" type="xs:float" />
    							<xs:element name="average" type="xs:float" />
    						</xs:sequence>
    						<xs:attribute name="city" type="xs:string" use="optional" />
    						<xs:attribute name="date" type="xs:date" use="optional" />
    					</xs:complexType>
    				</xs:element>
    			</xs:sequence>
    		</xs:complexType>
    	</xs:element>
    </xs:schema>
    My Request:
    Code:
    //
    // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2 
    package com.apress.springrecipes.weather.schemas;
    
    /**
     * <p>
     * Java class for anonymous complex type.
     * 
     * <p>
     * The following schema fragment specifies the expected content contained within
     * this class.
     * 
     * <pre>
     * &lt;complexType>
     *   &lt;complexContent>
     *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       &lt;sequence>
     *         &lt;element name="city" type="{http://www.w3.org/2001/XMLSchema}string"/>
     *         &lt;element name="date" type="{http://www.w3.org/2001/XMLSchema}date" maxOccurs="5"/>
     *       &lt;/sequence>
     *     &lt;/restriction>
     *   &lt;/complexContent>
     * &lt;/complexType>
     * </pre>
     * 
     * 
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(propOrder = { "city", "date" })
    @XmlRootElement(namespace = "http://springrecipes.apress.com/weather/schemas", name = "GetTemperaturesRequest" )
    public class GetTemperaturesRequest {
    
    	@XmlElement(required = true)
    	protected String city;
    	@XmlElement(required = true)
    	@XmlSchemaType(name = "date")
    	protected List<XMLGregorianCalendar> date;
    
    	/**
    	 * Gets the value of the city property.
    	 * 
    	 * @return possible object is {@link String }
    	 * 
    	 */
    	public String getCity() {
    		return city;
    	}
    
    	/**
    	 * Sets the value of the city property.
    	 * 
    	 * @param value
    	 *            allowed object is {@link String }
    	 * 
    	 */
    	public void setCity(String value) {
    		this.city = value;
    	}
    
    	/**
    	 * Gets the value of the date property.
    	 * 
    	 * <p>
    	 * This accessor method returns a reference to the live list, not a
    	 * snapshot. Therefore any modification you make to the returned list will
    	 * be present inside the JAXB object. This is why there is not a
    	 * <CODE>set</CODE> method for the date property.
    	 * 
    	 * <p>
    	 * For example, to add a new item, do as follows:
    	 * 
    	 * <pre>
    	 * getDate().add(newItem);
    	 * </pre>
    	 * 
    	 * 
    	 * <p>
    	 * Objects of the following type(s) are allowed in the list
    	 * {@link XMLGregorianCalendar }
    	 * 
    	 * 
    	 */
    	public List<XMLGregorianCalendar> getDate() {
    		if (date == null) {
    			date = new ArrayList<XMLGregorianCalendar>();
    		}
    		return this.date;
    	}
    
    	public void setDate(List xmlCalendarList) {
    		this.date = xmlCalendarList;
    
    	}
    }
    And my endpoint.

    Code:
    package com.apress.springrecipes.weather;
    
    import java.util.Date;
    import java.util.GregorianCalendar;
    import java.util.LinkedList;
    import java.util.List;
    
    import javax.xml.bind.JAXBElement;
    import javax.xml.datatype.DatatypeFactory;
    import javax.xml.datatype.XMLGregorianCalendar;
    
    import org.springframework.ws.server.endpoint.annotation.Endpoint;
    import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
    
    import com.apress.springrecipes.weather.schemas.GetTemperaturesRequest;
    import com.apress.springrecipes.weather.schemas.GetTemperaturesResponse;
    
    @Endpoint
    public class TemperatureMarshallingEndpoint {
    
    	private static final String namespaceUri = "http://springrecipes.apress.com/weather/schemas";
    
    	private WeatherService weatherService;
    
    	public void setWeatherService(WeatherService weatherService) {
    		this.weatherService = weatherService;
    	}
    
    	@PayloadRoot(localPart = "GetTemperaturesRequest", namespace = namespaceUri)
    	public JAXBElement<GetTemperaturesResponse> getTemperature(JAXBElement<GetTemperaturesRequest> request) {
    
    //		List<XMLGregorianCalendar> xmlCalendarList = request.getDate();
    //
    //		List dates = new LinkedList();
    //
    //		for (XMLGregorianCalendar xmlCalendar : xmlCalendarList) {
    //			Date date = xmlCalendar.toGregorianCalendar().getTime();
    //			dates.add(date);
    //		}
    //
    //		List<TemperatureInfo> infos = weatherService.getTemperatures(
    //				request.getCity(), dates);
    //
    //		List temperatures = new LinkedList();
    //
    //		for (TemperatureInfo info : infos) {
    //			GetTemperaturesResponse.TemperatureInfo temperature = new GetTemperaturesResponse.TemperatureInfo();
    //
    //			temperature.setAverage(info.getAverage());
    //			temperature.setMin(info.getMin());
    //			temperature.setMax(info.getMax());
    //			temperature.setCity(info.getCity());
    //
    //			try {
    //				GregorianCalendar calendar = new GregorianCalendar();
    //				calendar.setTime(info.getDate());
    //
    //				XMLGregorianCalendar xmlCalendar = DatatypeFactory
    //						.newInstance().newXMLGregorianCalendar(calendar);
    //
    //				temperature.setDate(xmlCalendar);
    //
    //			} catch (Exception e) {
    //				e.printStackTrace();
    //			}
    
    			//temperatures.add(temperature);
    		//}
    
    		GetTemperaturesResponse response = new GetTemperaturesResponse();
    		//response.setTemperatureInfo(temperatures);
    
    		return null;
    	}
    }
    This is my pom (related to web services):

    Code:
    <dependency>
    			<groupId>org.springframework.ws</groupId>
    			<artifactId>spring-ws-core-tiger</artifactId>
    			<version>1.5.10</version>
    			<exclusions>
    				<exclusion>
    					<groupId>org.springframework</groupId>
    					<artifactId>spring-core</artifactId>
    				</exclusion>
    			</exclusions>
    		</dependency>
    
    		<dependency>
    			<groupId>org.springframework.ws</groupId>
    			<artifactId>spring-ws-core</artifactId>
    			<version>1.5.10</version>
    			<exclusions>
    				<exclusion>
    					<groupId>org.springframework</groupId>
    					<artifactId>spring-core</artifactId>
    				</exclusion>
    			</exclusions>
    		</dependency>
    		<!-- JAXB2 -->
    		<dependency>
    			<groupId>javax.xml.bind</groupId>
    			<artifactId>jaxb-api</artifactId>
    			<version>2.1</version>
    		</dependency>
    		<dependency>
    			<groupId>com.sun.xml.bind</groupId>
    			<artifactId>jaxb-impl</artifactId>
    			<version>2.1.3</version>
    		</dependency>
    		<dependency>
    			<groupId>org.codehaus.mojo</groupId>
    			<artifactId>jaxb2-maven-plugin</artifactId>
    			<version>1.5</version>
    		</dependency>
    Please, I really need help with this issue.

    Thanks in advance.
Working...
X