You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Boot集成WSDL遭遇EndpointNotFound问题求助

Hey there, let's dig into why you're hitting that EndpointNotFound error after switching to a custom WSDL in your Spring Boot SOAP service. I've worked through similar headaches before, so let's break down the most likely culprits and cross-check against your setup:

1. Verify Endpoint Path & WSDL soap:address Alignment

First things first—make sure the endpoint path your Spring Boot service exposes matches the address defined in your custom WSDL:

  • Check your WebServiceConfig class: The ServletRegistrationBean for the message dispatcher servlet should have a urlMapping (like /ws/*) that aligns with the location attribute in your WSDL's <soap:address> tag. For example, if your WSDL specifies http://localhost:8080/ws/employee-service, your servlet mapping should cover /ws/* to catch that request.
  • Double-check the DefaultWsdl11Definition bean in your config: The setPortTypeName and setLocationUri values need to match the service and port names in your custom WSDL.

2. Match WSDL Target Namespace to @PayloadRoot Annotations

This is the #1 mistake I see with custom WSDLs:

  • Grab the targetNamespace value from your WSDL (look for <definitions targetNamespace="...">).
  • Compare it to the namespace parameter in every @PayloadRoot annotation in your endpoint class. They need to be exactly identical—even a single typo, case difference, or missing slash will cause Spring to fail matching requests to your endpoint methods.

Example fix if namespaces don't match:

// Wrong (using tutorial's namespace)
@PayloadRoot(namespace = "http://javainuse.com/spring", localPart = "GetEmployeeRequest")

// Correct (using your custom WSDL's namespace)
@PayloadRoot(namespace = "http://yourdomain.com/employee-service", localPart = "GetEmployeeRequest")

3. Validate Dependencies in pom.xml

Ensure you have the required Spring Web Services dependencies (and no conflicting versions):

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
    <groupId>wsdl4j</groupId>
    <artifactId>wsdl4j</artifactId>
</dependency>

Missing wsdl4j or using an outdated spring-boot-starter-web-services version can break WSDL parsing or endpoint registration.

4. Dig Into Your Console Logs

Your logs hold critical clues—look for these key entries:

  • Confirm your endpoint class is being registered: Look for lines like Registered endpoint handler mapping: org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping followed by your endpoint class name. If this is missing, Spring isn't scanning your endpoint bean.
  • Check WSDL loading: Look for Loaded WSDL from classpath: /your-custom.wsdl (or similar). If this doesn't appear, your setWsdlLocation in DefaultWsdl11Definition is pointing to the wrong file path.
  • When you send a request from SOAPUI, check the request path logged (e.g., POST /ws/employee-service). If this path doesn't match your configured endpoint mapping, that's a clear mismatch.

5. Fix SOAPUI Request Endpoint

SOAPUI often auto-populates the request endpoint from the WSDL's <soap:address> tag. If your service is running on a different port, host, or path than what's hardcoded in your WSDL, you'll need to manually update the endpoint in SOAPUI's request editor to match your running service (e.g., http://localhost:8080/ws/employee-service).

6. Check XSD & WSDL Association

If your custom WSDL references an XSD schema:

  • Ensure the XSD file is correctly placed in your classpath (e.g., src/main/resources).
  • Verify your XsdSchema bean in WebServiceConfig points to the correct XSD path:
    @Bean
    public XsdSchema employeeSchema() {
        return new SimpleXsdSchema(new ClassPathResource("employee.xsd"));
    }
    

A missing or misconfigured XSD can prevent the WSDL from being generated correctly, which breaks endpoint matching.

If you're still stuck, sharing snippets of your WebServiceConfig, the targetNamespace from your WSDL, and a sample @PayloadRoot annotation would help narrow things down further.

内容的提问来源于stack exchange,提问作者Robson Rocha

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:32:52