SoapFaultClientException:没有这样的操作

时间:2018-10-15 18:47:44

标签: java spring web-services

我在使用带有Spring Boot的spring-ws-core的webservice时遇到编码问题。下面的代码和我打算使用的服务的WSDL: 类模型

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class FuncionariosRequest implements Serializable {

    /**
     * 
     */
    @XmlTransient
    private static final long serialVersionUID = 1L;

    private String cpf;
    private String usuarioInformado;
    private String senhaInformada;

    public FuncionariosRequest() {
        super();
    }

    public FuncionariosRequest(String cpf, String usuarioInformado, String senhaInformada) {
        super();
        this.cpf = cpf;
        this.usuarioInformado = usuarioInformado;
        this.senhaInformada = senhaInformada;
    }

    public String getCpf() {
        return cpf;
    }

    public void setCpf(String cpf) {
        this.cpf = cpf;
    }

    public String getUsuarioInformado() {
        return usuarioInformado;
    }

    public void setUsuarioInformado(String usuarioInformado) {
        this.usuarioInformado = usuarioInformado;
    }

    public String getSenhaInformada() {
        return senhaInformada;
    }

    public void setSenhaInformada(String senhaInformada) {
        this.senhaInformada = senhaInformada;
    }

}

班级考试

@Component
public class Principal {

    private WebServiceTemplate webServiceTemplate = new WebServiceTemplate();

    @EventListener 
    private void teste(ApplicationReadyEvent event) {
        FuncionariosRequest servidor = new FuncionariosRequest();
        Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
        marshaller.setContextPath("br.gov.mt.gestao.ws.model");
        //marshaller.afterPropertiesSet();

        webServiceTemplate.setDefaultUri("http://gestao.com.br/sec_gestao/ws_seap_busca_func_cpf.jws");
        webServiceTemplate.setMarshaller(marshaller);
        webServiceTemplate.setUnmarshaller(marshaller);


        // Código do evento quando for disparado
        webServiceTemplate.marshalSendAndReceive(servidor);
    }

}

文件WSDL

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://webseap.gestao.mt.gov.br/sec_gestao/ws_seap_busca_func_cpf.jws" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://webseap.gestao.mt.gov.br/sec_gestao/ws_seap_busca_func_cpf.jws" xmlns:intf="http://webseap.gestao.mt.gov.br/sec_gestao/ws_seap_busca_func_cpf.jws" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->

   <wsdl:message name="FuncionariosResponse">

      <wsdl:part name="FuncionariosReturn" type="xsd:string"/>

   </wsdl:message>

   <wsdl:message name="FuncionariosRequest">

      <wsdl:part name="cpf" type="xsd:string"/>

      <wsdl:part name="usuarioInformado" type="xsd:string"/>

      <wsdl:part name="senhaInformada" type="xsd:string"/>

   </wsdl:message>

   <wsdl:portType name="ws_seap_busca_func_cpf">

      <wsdl:operation name="Funcionarios" parameterOrder="cpf usuarioInformado senhaInformada">

         <wsdl:input message="impl:FuncionariosRequest" name="FuncionariosRequest"/>

         <wsdl:output message="impl:FuncionariosResponse" name="FuncionariosResponse"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="ws_seap_busca_func_cpfSoapBinding" type="impl:ws_seap_busca_func_cpf">

      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="Funcionarios">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="FuncionariosRequest">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/>

         </wsdl:input>

         <wsdl:output name="FuncionariosResponse">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://webseap.gestao.mt.gov.br/sec_gestao/ws_seap_busca_func_cpf.jws" use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="ws_seap_busca_func_cpfService">

      <wsdl:port binding="impl:ws_seap_busca_func_cpfSoapBinding" name="ws_seap_busca_func_cpf">

         <wsdlsoap:address location="http://webseap.gestao.mt.gov.br/sec_gestao/ws_seap_busca_func_cpf.jws"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>

当我运行应用程序时,出现以下错误消息:

org.springframework.ws.soap.client.SoapFaultClientException: No such operation 'funcionariosRequest'
    at org.springframework.ws.soap.client.core.SoapFaultMessageResolver.resolveFault(SoapFaultMessageResolver.java:38) ~[spring-ws-core-3.0.3.RELEASE.jar:na]
    at org.springframework.ws.client.core.WebServiceTemplate.handleFault(WebServiceTemplate.java:830) ~[spring-ws-core-3.0.3.RELEASE.jar:na]
    at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:624) ~[spring-ws-core-3.0.3.RELEASE.jar:na]
    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555) ~[spring-ws-core-3.0.3.RELEASE.jar:na]
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390) ~[spring-ws-core-3.0.3.RELEASE.jar:na]
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:383) ~[spring-ws-core-3.0.3.RELEASE.jar:na]
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:373) ~[spring-ws-core-3.0.3.RELEASE.jar:na]
    at br.gov.mt.gestao.ws.Principal.teste(Principal.java:31) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_111]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_111]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_111]
    at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:261) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:180) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:142) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:400) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:354) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.boot.context.event.EventPublishingRunListener.running(EventPublishingRunListener.java:103) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.boot.SpringApplicationRunListeners.running(SpringApplicationRunListeners.java:78) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:349) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at br.gov.mt.gestao.ws.FrapsWsApplication.main(FrapsWsApplication.java:10) [classes/:na]

我想寻求帮助以了解问题所在。

0 个答案:

没有答案