2014-02-13 52 views
0

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

Web服务有多个操作,说过程1,过程2,process3等

如何调用有2场操作过程2。请打电话给我,下面的实施中缺少的是什么。

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); 

回答

0

我建议你比较XML至极由与它是由WS的WSDL需要您的应用程序产生的。

你可以通过SOAP UI和一些网络wireshark来实现。

我可以猜得出,但你需要一个nakespace声明这是SOAP消息的主体中的XML:

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

感谢。它在添加命名空间url后工作。 –