Spring WebService constructs the exception handling that occurs. Exception: Namespace_err:an attempt is made-to-create or change-an object-in-a-whi

Source: Internet
Author: User

Exception: Namespace_err:an attempt is made to the create or change of a object in a means whi----This is my own write a partial exception code that is displayed by the client call WebService console.

or call directly through SOAPUI:

The exception information is as follows

No Adapter for Endpoint [public org.jdom.Element com.mycompany.hr.ws.HolidayEndpoint.handleHolidayRequest ( Org.jdom.Element) throws Java.lang.Exception]: is your endpoint annotated with @Endpoint, or does it implement a supported Interface like MessageHandler or Payloadendpoint?

Documentation of the official Spring Webserivce project: Http://docs.spring.io/spring-ws/site/reference/html/tutorial.html's official use of the WebService case It's an employee's WebService system that uses DOMJ to make endpoint elements mapping

The cause of the error occurred:

Http://stackoverflow.com/questions/11683468/no-adapter-for-endpoint-sws

I think the problem lies here jira.springsource.org/browse/... There ' s a bug in endpoint mapping for JDOM elements

Solution copy Paste as follows: Replace the JDOM2 with Jdom

The working solution to your problem:

Add this dependencies to your pom.xml

Change the imports in your source for Jdom to Jdom2

And this is the updated version of Holidayendpoint:

PackageCom.MyCompany.Ws_template.Endpoint;ImportCom.MyCompany.Ws_template.Service.Humanresource;ImportJava.Text.SimpleDateFormat;ImportJava.Util.Date;ImportOrg.Jdom2.Jdomexception;ImportOrg.Jdom2.Namespace;ImportOrg.Jdom2.Element;ImportOrg.Jdom2.Filter.Filters;ImportOrg.Jdom2.Xpath.XPathExpression;ImportOrg.Jdom2.Xpath.Xpathfactory;ImportOrg.Springframework.Beans.Factory.Annotation.Autowired;ImportOrg.Springframework.Ws.Server.Endpoint.Annotation.Endpoint;ImportOrg.Springframework.Ws.Server.Endpoint.Annotation.Payloadroot;ImportOrg.Springframework.Ws.Server.Endpoint.Annotation.Requestpayload;@EndpointPublic Class Holidayendpoint {Private Static Final StringNamespace_uri= "Http://www.mycompany.com/holiday-service/schemas/holiday-request";Private XPathExpression<Element>Startdateexpression;Private XPathExpression<Element>Enddateexpression;Private XPathExpression<Element>Nameexpression;Private XPathExpression<Element>Surnameexpression;@Autowired Private HumanresourceHolidayservice;Public Holidayendpoint() Throws Jdomexception { Namespace Namespace = Namespace.GetNamespace("HR",Namespace_uri); XpathfactoryXpathfactory= Xpathfactory.Instance();Startdateexpression=Xpathfactory.Compile("//hr:startdate", Filters.Element(), Null, Namespace);Enddateexpression=Xpathfactory.Compile("//hr:enddate", Filters.Element(), Null, Namespace);Nameexpression=Xpathfactory.Compile("//hr:employeename", Filters.Element(), Null, Namespace);Surnameexpression=Xpathfactory.Compile("//hr:employeesurname", Filters.Element(), Null, Namespace);}@PayloadRoot(Namespace =Namespace_uri,Localpart= "Holidayrequest")Public voidHandleholidayrequest(@RequestPayload ElementHolidayrequest) Throws Exception { SimpleDateFormatSdf= New SimpleDateFormat("Yyyy-mm-dd"); DateStartDate=Sdf.Parse(Startdateexpression.Evaluate(Holidayrequest).Get(0).GetValue()); DateEndDate=Sdf.Parse(Enddateexpression.Evaluate(Holidayrequest).Get(0).GetValue()); StringName=Nameexpression.Evaluate(Holidayrequest).get (0 Getvalue ()  + surnameexpression evaluate (holidayrequest0  Holidayservice. (startdate, endDate , Name}}          /span>                

Spring WebService constructs the exception handling that occurs. Exception: Namespace_err:an attempt is made-to-create or change-an object-in-a-whi

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.