[英]Error with Web Service SOAP (Java)
i have this web service: 我有这个网络服务:
@WebService
public interface IRobotWhatsappService {
@WebMethod
@WebResult(name = "resultRobotWhatsapp")
public ResultRobotWhatsapp login (@WebParam(name = "correoPersonaQueEscanea") String correoPersonaQueEscanea);
@WebMethod
@WebResult(name = "resultRobotWhatsapp")
public ResultRobotWhatsapp leer (@WebParam(name = "nombreContactoParaLeer") String nombreContactoParaLeer,
@WebParam(name = "identificadorSesion") String identificadorSesion);
@WebMethod
@WebResult(name = "resultRobotWhatsapp")
public ResultRobotWhatsapp enviar(@WebParam(name =
"nombreContactoDestinatario") String nombreContactoDestinatario,
@WebParam(name = "mensaje")String mensaje,
@WebParam(name = "identificadorSesion")
String identificadorSesion);
}
And i have the most basic implementation: 我有最基本的实现:
@WebService(endpointInterface = "com.test.application.robot.ws.IRobotWhatsappService")
public class RobotWhatsappService implements IRobotWhatsappService{
@Override
public ResultRobotWhatsapp login(String correoPersonaQueEscanea) {
ResultRobotWhatsapp resultRobotWhatsapp =new ResultRobotWhatsapp();
resultRobotWhatsapp.setMessage("Login");
return resultRobotWhatsapp;
}
@Override
public ResultRobotWhatsapp leer(String nombreContactoParaLeer, String identificadorSesion) {
ResultRobotWhatsapp resultRobotWhatsapp =new ResultRobotWhatsapp();
resultRobotWhatsapp.setMessage("Leer");
return resultRobotWhatsapp;
}
@Override
public ResultRobotWhatsapp enviar(String nombreContactoDestinatario, String mensaje, String identificadorSesion) {
ResultRobotWhatsapp resultRobotWhatsapp =new ResultRobotWhatsapp();
resultRobotWhatsapp.setMessage("Enviar");
return resultRobotWhatsapp;
}
}
And in my web.xml i haver this configuration: 在我的web.xml中,我有以下配置:
<servlet>
<display-name>CXF Servlet</display-name>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/soap/*</url-pattern>
</servlet-mapping>
My WS shows the methods correctly but when i do a request i am getting the jsp for 405 status error. 我的WS正确显示了方法,但是当我执行请求时,我得到405状态错误的jsp。 In my securityContext.xml i have the exception:
在我的securityContext.xml中,我有一个例外:
<sec:intercept-url pattern="/RobotWhatsapp**" access="permitAll" />
<sec:intercept-url pattern="/soap/**" access="permitAll" />
And in my application context xml i have the bean and endpoint: 在我的应用程序上下文xml中,我具有bean和端点:
<bean id="robotWhatsappImplBean" class="com.konecta.application.robot.ws.RobotWhatsappService" />
<jaxws:endpoint id="robotWhatsappImpl" implementor="#robotWhatsappImplBean" address="/RobotWhatsapp" />
Do you have any idea about the problem? 您对这个问题有任何想法吗?
This is an example with soapui: 这是soapui的示例:
All that from here http://cxf.apache.org/docs/writing-a-service-with-spring.html 来自这里的所有内容http://cxf.apache.org/docs/writing-a-service-with-spring.html
I am using springSecurityFilterChain with CSRF protection. 我正在使用带有CSRF保护的springSecurityFilterChain。 That means i have to send a token when i do the request.
这意味着我必须在执行请求时发送令牌。 Everything was well, just i needed add this in my Security Context:
一切都很好,只需要在安全上下文中添加以下内容:
<sec:csrf disabled="true" />
If you have that configuration in a .java file, you could do this: 如果在.java文件中具有该配置,则可以执行以下操作:
.and().csrf().disable();
In your filters 在您的过滤器中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.