JAXB Marshsall Weblogic12c Problem

Problem

Application migration to 12c and jaxb not working on it

Description

The application is currently hosted on Weblogic 10 and consumes some web services. We send XML directly to the webservice using the HttpURLConnection. Before sending, we will issue a request and after receiving a response we will cancel them.

The application must be ported to 12c, and when we tested the application at 12c, it does not work. The request sent to the webservice had a difference. See below schema, java classes and sorted request

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 -->

Created Refund.java and related classes using the Eclipse -> Generate -> JAxB classes. I'm behind a firewall, and in the JAXB master he asked me for a proxy. I did not provide any pose. Class generated

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 (. ) -. - "XML "

javax.annotation_1.0.jar
javax.annotation_1.1.jar
javax.persistence_1.0.0.0_1-0.jar
javax.persistence_1.0.1.0_1-0.jar
javax.xml.bind_2.0.jar
javax.xml.bind_2.1.1.jar
jaxb-api.jar
jaxb-impl.jar
jaxws-api.jar
jaxws-rt.jar
jsr181-api.jar
jsr250-api.jar

Weblogic 12c jrockit160_29

private static  Marshaller mreqinfo;
JAXBContext jxcreq =JAXBContext.newInstance(RefundRequest.class.getPackage().getName());
             mreqinfo=jxcreq.createMarshaller();

mreqinfo.marshall(refundRequestObj)

, marshalled weblogic 12c. xmlns: ns0 = "", , ,

* * - 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 ( 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>
+4
3
+1

, jaxb jars (jaxb-core.jar, jaxb-impl.jar), jaxb jars Weblogic 12c. , jaxb , WEB-INF/lib weblogic.xml prefer-web-inf-classes. weblogic.xml WEB-INF

prefer-web-inf-classes

- weblogic.xml     (    ).   . True    , -       . -    , WebLogic Server.

. . http://docs.oracle.com/cd/E13222_01/wls/docs90/programming/classloading.html

weblogic.xml

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
<wls:weblogic-version>12.1.</wls:weblogic-version>
<wls:container-descriptor>
    <wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
</wls:container-descriptor>
<wls:container-descriptor>
    <wls:show-archived-real-path-enabled>true</wls:show-archived-real-path-enabled>
</wls:container-descriptor>
<wls:context-root>your_context_root_name</wls:context-root>

0

: JAXB & lt; ns0: TagName>. weblogic-application.xml:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application>
    <prefer-application-resources>
       <resource-name>META-INF/services/javax.xml.bind.*</resource-name>
    </prefer-application-resources>
</weblogic-application>
0

All Articles