Web服务 – JAXB Marshsall发布Weblogic12c

Web服务 – JAXB Marshsall发布Weblogic12c,第1张

概述问题 应用程序迁移到12c和jaxb不起作用 描述 该应用程序目前在Weblogic 10上,并消耗一些Web服务.我们使用HttpURLConnection将XML直接发布到Web服务.在发布之前,我们编组请求,在收到回复后,我们将其解组 该应用程序需要在12c上迁移,当我们在12c上测试应用程序时,它的工作方式不同.发送到webservice的请求有所不同.请参阅下面的架构,java类和编组请 问题

应用程序迁移到12c和jaxb不起作用

描述

该应用程序目前在Weblogic 10上,并消耗一些Web服务.我们使用httpURLConnection将XML直接发布到Web服务.在发布之前,我们编组请求,在收到回复后,我们将其解组

该应用程序需要在12c上迁移,当我们在12c上测试应用程序时,它的工作方式不同.发送到webservice的请求有所不同.请参阅下面的架构,java类和编组请求

refund.xsd----------<?xml version="1.0" enCoding="UTF-8"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:avis="http://www.avis.com/XMLSchema" elementFormDefault="unqualifIEd">    <xsd:element name="refundRequest">        <xsd:complexType>            <xsd:sequence>                <xsd:element ref="Request" avis:usage="ups"/>                <xsd:element ref="DeliveryNumber" avis:usage="ups"/>            </xsd:sequence>        </xsd:complexType>    </xsd:element><!-- Request and DeliveryNumber attributes her -->

使用Eclipse生成refund.java和相关类 – > Generate – > JAxB课程.
我在防火墙后面,在JAXB向导中它确实要求我提供代理.我没有提供任何poxy.生成的课程

refund.java

@XmlAccessorType(XmlAccesstype.FIELD)@XmlType(name = "",propOrder = {    "request","barCodeDeliveryNumber"})@XmlRootElement(name = "TrackRequest")public class refundRequest{    @XmlElement(name = "Request",required = true)    protected Request request;    @XmlElement(name = "DeliveryNumber",required = true)    protected String deliveryNumber;    /**     * Gets the value of the request property.     *      * @return     *     possible object is     *     {@link Request }     *          */    public Request getRequest() {        return request;    }    /**     * Sets the value of the request property.     *      * @param value     *     allowed object is     *     {@link Request }     *          */    public voID setRequest(Request value) {        this.request = value;    }/** * Gets the value of the DeliveryNumber property. *  * @return *     possible object is *     {@link String } *      */public String getDeliveryNumber() {    return barCodeDeliveryNumber;}/** * Sets the value of the barCodeDeliveryNumber property. *  * @param value *     allowed object is *     {@link String } *      */public voID setDeliveryNumber(String value) {    this.barCodeDeliveryNumber = value;}

将对象编组为XML(见下文)并将其传递给Web服务. Web服务返回“XML格式不正确”

应用程序库

javax.annotation_1.0.jarjavax.annotation_1.1.jarjavax.persistence_1.0.0.0_1-0.jarjavax.persistence_1.0.1.0_1-0.jarjavax.xml.bind_2.0.jarjavax.xml.bind_2.1.1.jarjaxb-API.jarjaxb-impl.jarjaxws-API.jarjaxws-rt.jarJsr181-API.jarJsr250-API.jar

Weblogic 12c使用jrockit160_29

代码片段

private static  Marshaller mreqinfo;JAXBContext jxcreq =JAXBContext.newInstance(refundRequest.class.getPackage().getname());             mreqinfo=jxcreq.createMarshaller();mreqinfo.marshall(refundRequestObj)

查看日志,我可以在weblogic 12c上看到关于编组请求的内容.
有一个xmlns:ns0 =“”,我认为这是在创建问题

** Marshalled Request – 在weblogic 12c jrockit160_29中尝试时没有工作
**

需要摆脱xmlns:ns0 =“”

<?xml version="1.0" enCoding="UTF-8"?><refundRequest  xmlns:ns0="">    <Request>        <TransactionReference>            <CustomerContext>YILE00010208201120.04.08.4|11/22/2013 12:28:31:085</CustomerContext>        </TransactionReference>        <RequestAction>refund</RequestAction>    </Request>    <DeliveryNumber>974869</DeliveryNumber></refundRequest>

*** Weblogic 10中的Marshalled Request(weblogic 10中的现有工作版本jrockit160_29

<?xml version="1.0" enCoding="UTF-8" standalone="yes"?><refundRequest>    <Request>        <TransactionReference>            <CustomerContext>YILE00010208201120.04.08.4|11/22/2013 12:28:31:085</CustomerContext>        </TransactionReference>        <RequestAction>refund</RequestAction>    </Request>    <DeliveryNumber>974869</DeliveryNumber></refundRequest>
解决方法 在您使用的WebLogic 12.1.1中,EclipseLink JAXB (MOXy)用作默认的 JAXB (JSR-222)提供程序(请参阅: http://blog.bdoughan.com/2011/12/eclipselink-moxy-is-jaxb-provider-in.html).您遇到的问题是由于Eclipselink 2.3.3版本中已修复的错误(当前版本为Eclipselink 2.5.1).

下面是一个链接,其中包含有关在WebLogic中使用较新版本的Eclipselink的说明:

> http://blog.bdoughan.com/2012/10/updating-eclipselink-in-weblogic.html

如果您是Oracle支持客户,则可以与他们通信以请求针对此问题的正式修补程序.

总结

以上是内存溢出为你收集整理的Web服务 – JAXB Marshsall发布Weblogic12c全部内容,希望文章能够帮你解决Web服务 – JAXB Marshsall发布Weblogic12c所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1055084.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-25
下一篇2022-05-25

发表评论

登录后才能评论

评论列表(0条)

    保存