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

  • Getting SOAP Fault: No adapter for endpoint

    Hi Friends,

    I tried to create a basic web-service using SpringWS. The web-service expects a Client element (complex type) and returns a String. I created the WSDL manually. It as as follows (clientcreation.wsdl):
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:schema="http://www.projectSS1.org/Client"
    xmlns:tns="http://www.projectSS1.org/ClientCreation/definitions"
    targetNamespace="http://www.projectSS1.org/ClientCreation/definitions" 
    xmlns:p="http://www.w3.org/2001/XMLSchema" 
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/">
    <wsdl:types>
    	<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.projectSS1.org/Client">
    	<xsd:complexType name="AddressType">
    		<xsd:sequence>
    			<xsd:element name="street_address" type="xsd:string" />
    			<xsd:element name="city" type="xsd:string" />
    			<xsd:element name="state" type="xsd:string" />
    			<xsd:element name="country" type="schema:CountryType" />
    		</xsd:sequence>
    	</xsd:complexType>
    	
    	<xsd:simpleType name="CountryType">    	
       		<xsd:restriction base="xsd:string">
       			<xsd:enumeration value="INDIA" />
       			<xsd:enumeration value="USA" />
       			<xsd:enumeration value="UK" />
       			<xsd:enumeration value="JAPAN" />
       			<xsd:enumeration value="SINGAPORE" />   
       		</xsd:restriction>    	
        </xsd:simpleType> 
    
    	<xsd:simpleType name="ClientType">    	
       		<xsd:restriction base="xsd:string">
       			<xsd:enumeration value="PROVIDER" />
       			<xsd:enumeration value="DIRECT CLIENT" />
       		</xsd:restriction>    	
        </xsd:simpleType>        
    
    	<xsd:element name="client" type="schema:Client"/>
    
    	<xsd:complexType name="Client">
    		<xsd:sequence>
    			<xsd:element name="type" type="schema:ClientType"/>
    			<xsd:element name="name" type="xsd:string" />
    			<xsd:element name="address" type="schema:AddressType" />
    			<xsd:element name="creationdate" type="xsd:date" />
    		</xsd:sequence>
    	</xsd:complexType>
    
    	<xsd:element name="clientid" type="xsd:string"/>
    	
    	</xsd:schema>
    </wsdl:types>
    
    	<wsdl:message name="ClientCreationRequest">
    		<wsdl:part name="client" element="schema:client"/>
    	</wsdl:message>
    
        <wsdl:message name="ClientCreationResponse">
        	<wsdl:part name="clientid" element="schema:clientid"></wsdl:part>
        </wsdl:message>
        
        <wsdl:portType name="ClientOperations">
        	<wsdl:operation name="ClientCreation">
        		<wsdl:input message="tns:ClientCreationRequest" name="ClientCreationRequest"></wsdl:input>
        		<wsdl:output message="tns:ClientCreationResponse" name="ClientCreationResponse"></wsdl:output>
        	</wsdl:operation>
        </wsdl:portType>
        
        <wsdl:binding name="ClientCreationBinding" type="tns:ClientOperations">
    		<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    		<wsdl:operation name="ClientCreation">
    			<soap:operation soapAction="http://www.projectSS1.org/ClientCreation"/>
    			<wsdl:input name="ClientCreationRequest">
    				<soap:body use="literal"/>
    			</wsdl:input>
    			<wsdl:output name="ClientCreationResponse">
    				<soap:body use="literal"/>
    			</wsdl:output>
    		</wsdl:operation>
    	</wsdl:binding>
    
        <wsdl:service name="ClientCreationService">
        	<wsdl:port name="ClientCreationPort" binding="tns:ClientCreationBinding">
        		<soap:address location="http://localhost:8080/nitspace/springws/ClientCreationService" />
        	</wsdl:port>
        </wsdl:service>
    </wsdl:definitions>
    I created an Endpoint class as well (ClientEndpoint.java):
    Code:
    package com.nitspace.springws.client;
    
    import java.text.SimpleDateFormat;
    import java.util.Date;
    
    import org.jdom.Element;
    import org.jdom.JDOMException;
    import org.jdom.Namespace;
    import org.jdom.xpath.XPath;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.ws.server.endpoint.annotation.Endpoint;
    import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
    import org.springframework.ws.server.endpoint.annotation.RequestPayload;
    import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
    
    
    import com.nitspace.dao.IClientDao;
    
    
    @Endpoint
    public class ClientEndpoint
    {
        private static final String NAMESPACE_URI = "http://www.projectSS1.org/Client";
        //private static final String NAMESPACE_URI = "http://www.projectSS1.org/ClientCreation/definitions";
        
        private XPath clientTypeExpression;
        private XPath nameExpression;
        private XPath streetAddressExpression;
        private XPath cityExpression;
        private XPath stateExpression;
        private XPath countryExpression;
        private XPath creationDateExpression;
       
        private IClientDao clientDao;
        
        @Autowired
        public ClientEndpoint(IClientDao clientDao) throws JDOMException
        {
        	this.clientDao=clientDao;
        	System.out.println("Hi Nitin inside ClientEndpoint() constructor...clientDao set to-->"+this.clientDao);
        	
        	Namespace namespace = Namespace.getNamespace("cns", NAMESPACE_URI);
        
        	clientTypeExpression=XPath.newInstance("//cns:type");
        	clientTypeExpression.addNamespace(namespace);
        	nameExpression=XPath.newInstance("//cns:name");
        	nameExpression.addNamespace(namespace);
        	streetAddressExpression=XPath.newInstance("//cns:street_address");
        	streetAddressExpression.addNamespace(namespace);
        	cityExpression=XPath.newInstance("//cns:city");
        	cityExpression.addNamespace(namespace);
        	stateExpression=XPath.newInstance("//cns:state");	
        	stateExpression.addNamespace(namespace);
        	countryExpression=XPath.newInstance("//cns:country");
        	countryExpression.addNamespace(namespace);
        	creationDateExpression=XPath.newInstance("//cns:creationdate");
        	creationDateExpression.addNamespace(namespace);
        }
    
        
        @PayloadRoot(namespace = NAMESPACE_URI, localPart = "client")
        public @ResponsePayload String handleClientCreationRequest(@RequestPayload Element client) throws Exception {
        	System.out.println("Hi Nitin inside ClientEndpoint --> handleClientCreationRequest()");
        	SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
            String clientName=nameExpression.valueOf(client);
            String clientType=clientTypeExpression.valueOf(client);
            String street=streetAddressExpression.valueOf(client);
            String city=cityExpression.valueOf(client);
            String state=stateExpression.valueOf(client);
            String country=countryExpression.valueOf(client);        		
            Date creationDate = dateFormat.parse(creationDateExpression.valueOf(client));        
            
            System.out.println("Printing Input From Client-->");
            System.out.println("Client Name="+clientName);
            System.out.println("Client Type="+clientType);       
            
            return "5";        
        }
        
    }
    However, when I send the following SOAP message:

    Code:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    	<SOAP-ENV:Body>
    		<m:client xmlns:m="http://www.projectSS1.org/Client">
    			<type>PROVIDER</type>
    			<name>Shinchan Corporation</name>
    			<address>
    				<street_address>H-708, Sector-63</street_address>
    				<city>Noida</city>
    				<state>Uttar Pradesh</state>
    				<country>INDIA</country>
    			</address>
    			<creationdate>1967-08-13</creationdate>
    		</m:client>
    	</SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    then I get the SOAP Fault:


    <faultstring xml:lang="en">No adapter for endpoint [public java.lang.String com.nitspace.springws.client.ClientEndpoint.handle ClientCreationRequest(org.jdom.Element) throws java.lang.Exception]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?</faultstring>

    I am unable to figure out where am I making mistake. I believe I am making some mistake in using annotations on handleClientCreationRequest() endpoint method in ClientEndpoint.java, but not sure.
    Please help.
    Nitin
    Last edited by nitinbhardwaj21; Jan 17th, 2012, 11:39 AM. Reason: making it a bit more readable

  • #2
    If I were you, I think the error can be debugged and traced down as:

    1. log4j.logger.org.springframework.ws=TRACE
    2. look at the SpringWS 2.x source code during the debugging process
    3. Read slowly again http://static.springsource.org/sprin...rver-endpoints

    5.4.1. @Endpoint handling methods
    5.4.1.1. Handling method parameters
    5.4.1.2. Handling method return types

    (This is a fun excercise and you will gain a lot of knowledge in terms of architectural flow from 1 piece to another.
    Good luck.)

    Comment


    • #3
      Thanks Paul. I'll try to proceed in the direction as suggested by you.
      Regards,
      Nitin

      Comment

      Working...
      X