======= Xfire 添加 soapAction 问题,在线等。。。

Ghost_520 2014-03-26 03:04:59
【服务端处理】
我发布的 wsdl 中 soapAction 中为空的, 导致我调用失败, 所以我想手动制定 soapAction 的路径, 但是怎么添加在wsdl 中都没有添加进去,附上部分wsdl 代码

<wsdl:binding name="CalculatorServiceHttpBinding" type="tns:CalculatorServicePortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="multiply">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="multiplyRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="multiplyResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="divide">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="divideRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="divideResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="add">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="addRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="addResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>


接口java 代码:

public interface CalculatorService {

@WebMethod(operationName = "add" ,action = "urn:add")
public int add(int a, int b);

@WebMethod(operationName = "multiply" ,action = "urn:multiply")
public int multiply(int a, int b);

@WebMethod(operationName = "divide" , action = "urn:divide")
public int divide(int a, int b);
}


services.xml 代码:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">
<service >
<name>CalculatorService</name>
<serviceClass>com.test.service.CalculatorService</serviceClass>
<implementationClass>com.test.service.impl.CalculatorServiceImpl</implementationClass>

<properties name="method">
<bean class="org.codehaus.xfire.spring.config.MethodBean">
<property name="name" value="add" />
<property name="soapAction" value="urn:add" />
</bean>
<bean class="org.codehaus.xfire.spring.config.MethodBean">
<property name="name" value="multiply" />
<property name="soapAction" value="urn:multiply" />
</bean>
<bean class="org.codehaus.xfire.spring.config.MethodBean">
<property name="name" value="divide" />
<property name="soapAction" value="urn:divide" />
</bean>
</properties>
</service>
</beans>
...全文
137 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Ghost_520 2014-03-26
  • 打赏
  • 举报
回复
搞定了啊, 大版主, 您太牛了, 一下就解决了
Ghost_520 2014-03-26
  • 打赏
  • 举报
回复
@WebService(name = "testsoapaction", serviceName = "hahah", targetNamespace = "http://xxoo.com") 是写在实现类里面还是借口类里面?
  • 打赏
  • 举报
回复
  • 打赏
  • 举报
回复
官方网站下载最新的xfire包。

package com.ws.test;

import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService(name = "testsoapaction", serviceName = "hahah", targetNamespace = "http://xxoo.com")
public class SoapServiceImpl {

	@WebMethod(action = "urn:Test", operationName = "test")
	public String example(String message) {
		return message;
	}

}
service.xml这样写:

<beans>
	   <service xmlns="http://xfire.codehaus.org/config/1.0">
      <name>HelloService</name>
     <serviceClass>com.ws.test.SoapServiceImpl</serviceClass>
     <serviceFactory>org.codehaus.xfire.annotations.AnnotationServiceFactory</serviceFactory>
  </service>
</beans>
上面的serviceFactory必须写。
Ghost_520 2014-03-26
  • 打赏
  • 举报
回复
顶啊的, 顶 啊 ,
Ghost_520 2014-03-26
  • 打赏
  • 举报
回复
顶啊的, 顶 啊 ,
Ghost_520 2014-03-26
  • 打赏
  • 举报
回复
顶啊的, 顶 啊 ,

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧