如何在Javax SOAP WebService中将字符串传递给响应

问题描述

我通过JAX-WS从wsdl生成了该类:

    <wsdl:operation name="Abcop">
        <wsdl:input message="tns:AbcRequest"/>
        <wsdl:output message="tns:AbcResponse"/>
        <wsdl:fault message="tns:AbcFault" name="fault"/>
    </wsdl:operation>

我有SOAP Web服务,该服务通过SOAP将数据发送到另一个系统,并且不进行映射就返回所有内容(我是两个系统之间的中间件,所以我是服务器和客户端)。

@WebService(endpointInterface = "com.abccompany.abc.generated.Abc")
@HandlerChain(file="handlers.xml")
public class AbcServiceImpl extends SpringBeanAutowiringSupport implements Abc {
    private static final Logger LOGGER =
        LoggerFactory.getLogger(AbcServiceImpl.class);

    @Autowired
    private AbcService abcService = new AbcService();

    @Resource
    private WebServiceContext ctx;

    @Override
    public AbcResponse abcop(Abc parameters) throws AbcFault {
        LOGGER.info("Endpoint received request");
        String trgSysId = (String) ctx.getMessageContext().get("TARGETSYstemID");
        LOGGER.info("targetSystemId: " + trgSysId);
        String url = abcService.getUrl(trgSysId);
        LOGGER.info("Calling url: " + url);
        SOAPMessage request = (SOAPMessage) ctx.getMessageContext().get("REQUEST");

        // From this method I can get response in javax.xml.soap.soAPMessage
        SOAPMessage response = abcService.callSoapWebService(request,url);

        return ???;
    }
}

当返回类型为javax.xml.soap.soAPMessage(由JAX-WS生成)时,如何从String(或简单的StreamAbcResponse)传递普通的SOAP响应?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)