- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个使用 Axis1 制作的可用 Web 服务,我正在将其迁移到 Jaxws
我正在使用 wsimport 和 maven 从我的工作 WSDL 文件创建客户端类。
我遇到的问题是,我可以在记录器中看到包含数据的 SOAP 响应消息,但对象并未填充此数据。
我的wsdl看起来像这样(我只发布了1个服务以使其更短并删除了一些元素,所以请忽略是否有一些缺失,例如ResultadoProcesamiento):
<wsdl:definitions targetNamespace="http://ws.test" xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://ws.test"
xmlns:intf="http://ws.test"
xmlns:tns1="http://pojo.test"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://ws.test" xmlns="http://www.w3.org/2001/XMLSchema" >
<import namespace="http://pojo.test"/>
<element name="validarCertificado">
<complexType>
<sequence>
<element name="cert" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="validarCertificadoResponse">
<complexType>
<sequence>
<element name="validarCertificadoReturn" type="tns1:MensajeSalida"/>
</sequence>
</complexType>
</element>
</schema>
<schema elementFormDefault="qualified" targetNamespace="http://pojo.test" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://ws.test"/>
<complexType name="Respuesta">
<sequence>
<element name="excepcion" nillable="true" type="tns1:Excepcion"/>
<element name="resultadoProcesamiento" nillable="true" type="tns1:ResultadoProcesamiento"/>
</sequence>
</complexType>
<complexType name="MensajeSalida">
<sequence>
<element name="peticion" nillable="true" type="xsd:string"/>
<element name="respuesta" nillable="true" type="tns1:Respuesta"/>
<element name="versionMsg" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="validarCertificadoRequest">
<wsdl:part element="impl:validarCertificado" name="parameters"/>
</wsdl:message>
<wsdl:message name="validarCertificadoResponse">
<wsdl:part element="impl:validarCertificadoResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="WsTest">
<wsdl:operation name="validarCertificado">
<wsdl:input message="impl:validarCertificadoRequest" name="validarCertificadoRequest"/>
<wsdl:output message="impl:validarCertificadoResponse" name="validarCertificadoResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="WsTestSoapBinding" type="impl:WsTest">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="validarCertificado">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="validarCertificadoRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="validarCertificadoResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="WsTestService">
</wsdl:service>
</wsdl:definitions>
我被迫创建 2 个包,因为我有一些具有相同名称但来自不同架构的元素。
第一个包:
package-info.java
@XmlSchema(namespace = "http://ws.test", elementFormDefault = XmlNsForm.QUALIFIED)
package test.ws;
ValidarCertificadoResponse.java
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "validarCertificadoReturn" })
@XmlRootElement(name = "validarCertificadoResponse")
public class ValidarCertificadoResponse {
@XmlElement(required = true)
protected MensajeSalida validarCertificadoReturn;
第二个包:
package-info.java
@XmlSchema(namespace = "http://pojo.test", elementFormDefault = XmlNsForm.QUALIFIED)
package pojo.ws;
MensajeSalida.java
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MensajeSalida", propOrder = { "peticion", "respuesta", "versionMsg" })
public class MensajeSalida {
@XmlElement(required = true, nillable = true)
protected String peticion;
@XmlElement(required = true, nillable = true)
protected Respuesta respuesta;
@XmlElement(required = true, nillable = true)
protected String versionMsg;
以及我的响应 SOAP 消息(它仅包含一些标签):
<soapenv:Body>
<validarCertificadoResponse xmlns="http://ws.test">
<validarCertificadoReturn>
<peticion>value1</peticion>
<respuesta>
datas
<respuesta/>
<resultadoProcesamiento>
more datas
</resultadoProcesamiento>
执行 jaxws-maven-plugin:2.3 生成的客户端后,我的 ValidarCertificadoResponse 具有以下属性:
ValidarCertificadoResponse.java
validarCertificadoReturn
peticion = null;
respuesta = null;
resultadoProcesamiento = null;
你有发现什么不对吗?我猜 WSDL 中有错误,或者插件可能没有正确创建 header ?
谢谢。
最佳答案
我找到了解决问题的方法。
如果我们检查响应 SOAP 消息,我们可以看到只有一个命名模式 ( http://ws.test ),因此属于第二个模式的所有其他元素都无法转换,因为 jaxws 找不到匹配项。
我无法修改 Web 服务,因为它不是我的,因此我将我的 wsdl 调整为只有 1 个架构。我想这不是最干净的解决方案,但它确实有效。
以下是如何执行此操作的示例:
之前:
<element name="validarCertificadoResponse">
<complexType>
<sequence>
<element name="validarCertificadoReturn" type="tns1:MensajeSalida"/>
</sequence>
</complexType>
</element>
之后:
<xsd:element name="validarCertificadoResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="validarCertificadoReturn">
<!-- This is the content of tns1:MensajeSalida -->
<xsd:complexType>
<xsd:sequence>
<xsd:element name="peticion" type="xsd:string"/>
<!-- This is the content of tns1:Respuesta -->
<xsd:element name="respuesta">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="excepcion" nillable="true">
<!-- This is the content of tns1:Excepcion -->
<xsd:complexType>
<xsd:sequence>
<xsd:element name="codigoError" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="resultadoProcesamiento" nillable="true">
<!-- This is the content of tns1:ResultadoProcesamiento -->
<xsd:complexType>
<xsd:sequence>
<xsd:element name="resultado" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="versionMsg" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
关于java - Jaxws 不填充结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25968151/
我收到此错误消息: [WARNING] Ignoring: binding file "file:/home/jeusdi/projects/salut/hes/hes-visor-api-servi
查看来自 java.net 的 JAX-WS Maven 存储库 - http://download.java.net/maven/2/com/sun/xml/ws/ 有两个类似的文件夹 - jaxw
我正在使用 JAXWS 生成 Web 服务并使用 EndPoint.publish() 提供服务以及部署 war 文件,但是一旦它处理了 100 个请求,它就不会返回第 101 个请求回复。如何配置
我一直使用 wsimport 工具从 WSDL 文件生成客户端类。然后我将它们包含到项目的源代码树中,并将它们 checkin 版本控制系统。但最近我了解到有一个名为 jaxws-maven-plug
我尝试使用以下代码生成 java 类,但由于某些 gradle 插件问题而失败。 我搜索了一下,发现有很多插件可用于生成xsd类的java,但只有很少的插件用于生成代码形式wsdl.jaxb 是我想使
是否可能,如果可能,如何? 最佳答案 实际上,WebLogic 10.3 中捆绑的 JAX-WS 实现基于 JAX-WS RI 2.1.4,如 What's New in WebLogic Serve
由于 JAX-WS 依赖于 JAXB,并且由于我观察到在 JAX-B 引用实现中解压 XML bean 的代码,我猜没有区别并且 JAXWS 客户端总是返回一个空集合,即使 web 服务结果是空元素:
我有一个使用 Axis1 制作的可用 Web 服务,我正在将其迁移到 Jaxws 我正在使用 wsimport 和 maven 从我的工作 WSDL 文件创建客户端类。 我遇到的问题是,我可以在记录器
有人可以帮我吗? 我正在尝试连接 Web 服务;这是我的代码: public class test { static Logger logger = Logger.getLogger(test
这个问题在这里已经有了答案: How to change webservice url endpoint? (4 个回答) 关闭7年前。 如何动态更改我的 JAXWS 客户端正在使用的地址?此客户端由
我需要通过 SOAP Web 服务调用长时间运行的任务,在两端使用 JAXWS,特别是在两端使用 Apache CXF 2.6。 我看到我可以在 CXF 代码生成器中启用异步方法,它为每个操作创建两个
我在 maven 3 中使用 netbeans。当我尝试使用 jaxws-maven-plugin 进行编译时,出现以下错误。 这是我的 pom
我每次尝试使用 wsdl2java 工具时都会出现同样的错误。任何想法非常感谢-fe jaxbs 没有帮助。看起来找不到tools-plugin.xml。 15:18:37.618 [main] DE
我正在用Spring构建一个Web服务。我可以构建项目并将其部署到tomcat,但是当服务器启动时,出现以下错误: Invalid NamespaceHandler class [org.apache
我正在使用带有 JaxWS maven 插件的 NetBeans。我的应用程序有大约 5 个不同的 wsdls 我需要加载。我的问题是我想阻止 maven 或 wsimport 每次重新编译我的 ws
我有一个使用 JAX-WS 创建的 WebService,我编写了一个 JUnit 以通过以下方式连接到它: public class LicenseSvcClient { private s
我已经设置了一个 JAXWS 客户端并将一个 SoapHandler 实现添加到它的 Binding handlerChain。所有这一切都是为了在服务未正常运行时查看原始服务响应。 当一切正常时,我
我对编写网络服务相当陌生。我正在使用 JAXWS 开发 SOAP 服务。我希望能够让用户登录并在我的服务中知道哪个用户正在发出命令。换句话说,进行一些 session 处理。 我见过的一种方法是使用
您好,我已经编写了一个 WSDL 文件并生成了我的 Web 服务。我现在想像这样调用该服务: res = new UpdateCatalogWebService().getUpdateCatalogP
我使用 wsimport 从 wsdl 生成类。现在我正在解决缺少的依赖项,其中一些属于 javax.xml.ws:jaxws-api: 导入 javax.xml.ws.Service; 导入 jav
我是一名优秀的程序员,十分优秀!