问题描述
我是 spring boot ws 的新手。我使用这个 tutorial 创建了我的第一个网络服务。 Web 服务创建数据库条目。当我使用 soapUI 检查我的网络服务功能时,一切似乎都按预期工作。将来应该从第三方应用程序使用网络服务。
这是我的 .xsd 文件:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.de/webservice"
elementFormDefault="unqualified">
<xs:element name="getXyzRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="value1" type="xs:string"/>
<xs:element name="value2" type="xs:string"/>
<xs:element name="value3" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getXyzResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="value" type="xs:string"/>
<xs:element name="result" type="xs:string"/>
<xs:element name="message" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
如果我手动使用soapUI测试,我得到的请求是:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:aut="http://www.example.de/webservice">
<soapenv:Header/>
<soapenv:Body>
<aut:getXyzRequest>
<value1>TESTVALUE1</value1>
<value2>TESTVALUE2</value2>
<value3>TESTVALUE3</value3>
</aut:getXyzRequest>
</soapenv:Body>
</soapenv:Envelope>
如果我使用第三方应用程序,我得到的请求是:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getXyz
xmlns="http://www.example.de/webservice/">
<value1
xmlns="http://www.example.de/webservice">TESTVALUE1
</value1>
<value2
xmlns="http://www.example.de/webservice">TESTVALUE2
</value2>
<value3
xmlns="http://www.example.de/webservice">TESTVALUE3
</value3>
</getXyz>
</soap:Body>
</soap:Envelope>
事实上这以 404 结束。在日志文件中我看到
org.springframework.ws.server.Messagedispatcher: No endpoint mapping found for [saajSoapMessage {http://www.example.de/webservice/}getXyz]
这是我的端点:
@Endpoint
public class XyzEndpoint {
private static final String NAMESPACE="http://www.example.de/webservice";
@Autowired
private XyzService service;
@PayloadRoot(namespace = NAMESPACE,localPart = "getXyzRequest")
@ResponsePayload
public GetXyzResponse getXyz(@RequestPayload GetXyzRequest request) {
return service.getXyzValue(request);
}
我现在的问题是:
- 如何使用同一个服务获得两个完全不同的 xml 请求。
- 如何更改服务以适应请求 2。
我很感谢我可以阅读有关此问题的每个提示或链接。我没有找到这方面的东西。如果需要,我可以分享更多信息。 提前致谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)