【问题标题】:Spring Integration Web Service client not workingSpring Integration Web 服务客户端不工作
【发布时间】:2014-02-13 12:53:25
【问题描述】:

从 Spring 集成客户端调用 Web 服务时出现“无法找到此远程调用的匹配操作”错误。

Web Service 有多个操作,比如 process1、process2、process3 等。

如何调用具有 2 个字段的 Operation process2。请告诉我,以下实现中缺少什么。

Spring 集成配置文件:

    <bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
        <property name="classesToBeBound">
            <list>
                <value>com.model.Request</value>
            </list>
        </property>
    </bean>

    <int:gateway id="ws" service-interface="com.gateway.WsGateway"
        default-request-channel="inputChannel" />

    <int-ws:outbound-gateway request-channel="inputChannel"
        marshaller="jaxbMarshaller"
        uri="wsdl_url" />

WsGateway.java

public interface WsGateway {
    @Gateway(requestChannel = "inputChannel")
    public void callWS(Request request);
}

Request.java

@XmlAccessorType(value = XmlAccessType.FIELD)
@XmlRootElement(name = "process2")
public class Request {

    @XmlElement(name = "name")
    private String name;

    @XmlElement(name = "dept")
    private String dept;
}


Main.java

Request req = new Request();
req.setName("foo");
req.setDept("xyz");

gateway.callWS(req);

【问题讨论】:

    标签: web-services webservice-client spring-integration


    【解决方案1】:

    我建议您将应用程序生成的 XML 与 WS 的 WSDL 所需的 XML 进行比较。

    您可以通过 SOAP UI 和一些网络 wireshark 来完成。

    我可能猜到了,但是您需要一个用于 XML 的 nakespace 声明,它是 SOAP 消息的主体:

    @XmlType(name = 'RequestType', namespace = 'THE_NAMESPACE_URL')
    @XmlAccessorType(value = XmlAccessType.FIELD)
    @XmlRootElement(name = "process2", namespace = 'THE_NAMESPACE_URL')
    public class Request
    

    【讨论】:

      猜你喜欢
      • 2014-09-04
      • 1970-01-01
      • 2013-06-29
      • 2014-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多