WS发送的生成的xml中的multiRef [英] multiRef in generated xml sending by WS

查看:494
本文介绍了WS发送的生成的xml中的multiRef的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在jboss上的本地计算机上运行的应用程序.
我下载了wsdl文件,在eclipse中生成了Java代码.运行并出现异常:

I have application that running on my local machine on jboss.
I downloaded wsdl file, generate java code in eclipse. Run and have exception:

在处理请求时发现异常:反序列化错误: java.lang.NumberFormatException:对于输入字符串:"

caught exception while handling request: deserialization error: java.lang.NumberFormatException: For input string: ""

(应用程序可以与另一个简单的WS一起正常使用).

(Application correctly work with another simple WS).

经过一番谷歌搜索后,我发现代码生成了错误的xml:
预期:

After some Googling I found that code generate wrong xml:
expected:

<soapenv:Body>
    <ns1:setLevel soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:ns1="###">
        <id xsi:type="xsd:string">x2148</id>
        <level xsi:type="xsd:long">5</level>
    </ns1:setLevel>
</soapenv:Body>

但是通过TCPMon/Fiddler,我发现我的请求看起来像这样:

but through TCPMon/Fiddler i found that my requests look like that:

<soapenv:Body>
    <ns1:setLevel soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:ns1="###">
        <id xsi:type="xsd:string">x2148</id>
        <level href="#id0" />
    </ns1:setLevel>
    <multiRef id="id0" soapenc:root="0"
        soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xsi:type="xsd:long" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">5</multiRef>
</soapenv:Body>  

在谷歌搜索后,我发现解决方案正在改变

after googling i found that solution is change

<parameter name="sendMultiRefs" value="true"/>

在服务器端的server-config.wsdd文件中为false.但是我没有这个文件.
有什么办法吗?我只看到一种解决方案-在运行时更改xml文件-但这听起来不好.

on false in server-config.wsdd file on server side. But i don't have this file.
Any solutions? I see only one solution - change xml file on runtime - but it's sounds not good.

推荐答案

server-config.wsdd文件是远程服务描述的一部分.发布您下载的WSDL的实体(服务提供商)将不得不对其进行更改并重新部署.幸运的是,如果您发布了该服务...则可以对其进行更改.如果与第三方打交道,会很不幸.

The server-config.wsdd file is a part of the remote service description. The entity that published that WSDL you downloaded (service provider) would have to change it and redeploy on their side. Lucky you if you published the service...you can change it. Unlucky you if dealing with third-party.

我们通过将样式表应用于响应以展平多重引用来解决类似的问题.实际上是从StackOverflow获得样式表的[此处] [1] 创建XSLT转换以展平multiRef编码的SOAP消息

We dealt with a similar problem by applying a stylesheet to the response to flatten the multi refs. Got the stylesheet from StackOverflow in fact [here][1]Creating XSLT transform to flatten multiRef encoded SOAP message

它可以很好地将响应平展到您期望的模式.但请注意,它不能处理multiRefs的multiRefs.我自己需要解决方案.

It works pretty good as is to flatten the response back to the schema you were expecting. But be warned, it doesn't handle multiRefs of multiRefs. I need a solution to that myself.

这篇关于WS发送的生成的xml中的multiRef的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆