Нет десериализатора для класса java.lang.Object - PullRequest
0 голосов
/ 17 сентября 2018

Я пытаюсь использовать веб-сервис ( BargainFinderMaxService_ADRQ сервис Sabre ) и столкнулся с проблемой.Я импортировал файл WSDL и получил сгенерированные классы Java.Я не могу подключиться к веб-сервису и получить исключение.

Файл WSDL: http://files.developer.sabre.com/wsdl/sabreXML1.0.00/shopping/BargainFinderMax_ADRQ_v4-2-0.wsdl

Код клиента (если мы комментируем эту строку, исключение не приходит, но этот параметр является обязательным: - actionTypeRequestType.setName ("AD3"); )

        OTA_AirLowFareSearchRQTPA_Extensions tpaExtensions = new 
        OTA_AirLowFareSearchRQTPA_Extensions();
        TransactionType intelliSellTransaction = new TransactionType();

        TransactionTypeRequestType transactionTypeRequestType = new 
        TransactionTypeRequestType();
        transactionTypeRequestType.setName("AD3");
        intelliSellTransaction.setRequestType(transactionTypeRequestType);
        tpaExtensions.setIntelliSellTransaction(intelliSellTransaction );
        airLowFareSearchRQ.setTPA_Extensions(tpaExtensions);
        BargainFinderMaxPortType portType = setBindingPort(wcUrl);
        System.out.println("wcUrl in BFMImpl ###::::"+wcUrl);
        airLowFareSearchRS = portType.bargainFinderMax_ADRQ(header1, header2, airLowFareSearchRQ);

Проблема возникает в этой строке:

java.lang.Object _resp = _call.invoke (new java.lang.Object [] {header.value, header2.value, body});

Вот целый метод

public org.opentravel.www.OTA._2003._05.OTA_AirLowFareSearchRS bargainFinderMax_ADRQ(org.ebxml.www.namespaces.messageHeader.holders.MessageHeaderHolder header, org.xmlsoap.schemas.ws._2002._12.secext.holders.SecurityHolder header2, org.opentravel.www.OTA._2003._05.OTA_AirLowFareSearchRQ body) throws java.rmi.RemoteException {
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(_operations[0]);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("BargainFinderMax_ADRQ");
        _call.setEncodingStyle(null);
        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        _call.setOperationName(new javax.xml.namespace.QName("", "BargainFinderMax_ADRQ"));

        setRequestHeaders(_call);
        setAttachments(_call);
 try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {header.value, header2.value, body});
         W2GLogger.printInfo(Constants.MICROSERVICE_NAME, serviceSec1,"requestXML::::",_call.getMessageContext().getRequestMessage().getSOAPPartAsString());
         W2GLogger.printInfo(Constants.MICROSERVICE_NAME, serviceSec1,"responseXML::::",_call.getMessageContext().getResponseMessage().getSOAPPartAsString());

        if (_resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)_resp;
        }

Ошибка (при использовании автоматически сгенерированных классов)

org.xml.sax.SAXException: No deserializer for class java.lang.Object
      at org.apache.axis.encoding.ser.SimpleDeserializer.onStartElement(SimpleDeserializer.java:383) ~[axis.jar:na]
      at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:393) ~[axis.jar:na]
      at org.apache.axis.encoding.DeserializerImpl.onStartElement(DeserializerImpl.java:449) ~[axis.jar:na]
      at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:393) ~[axis.jar:na]
      at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048) ~[axis.jar:na]
      at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165) ~[axis.jar:na]
      at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141) ~[axis.jar:na]
      at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236) ~[axis.jar:na]
      at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384) ~[axis.jar:na]
      at org.apache.axis.client.Call.invoke(Call.java:2467) [axis.jar:na]
      at org.apache.axis.client.Call.invoke(Call.java:2366) [axis.jar:na]
      at org.apache.axis.client.Call.invoke(Call.java:1812) [axis.jar:na]
      at com.sabre.webservices.websvc.BargainFinderMaxBindingStub.bargainFinderMax_ADRQ(BargainFinderMaxBindingStub.java:6162) [classes/:na]
      at com.wipro.w2g.partner.airline.calendarShopping.sabre.BargainFinderMaxServiceImpl.getBFMShoppingRequest(BargainFinderMaxServiceImpl.java:205) [classes/:na]

Вот запрос, который я получаю (когда сам создаю сообщения)

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header>
        <ns1:MessageHeader
            xmlns:ns1="http://www.ebxml.org/namespaces/messageHeader">
            <ns1:From>
                <ns1:PartyId>client.webconnect@sabre.com</ns1:PartyId>
            </ns1:From>
            <ns1:To>
                <ns1:PartyId>client.webconnect@sabre.com</ns1:PartyId>
            </ns1:To>
            <ns1:CPAId>QI6D</ns1:CPAId>
            <ns1:ConversationId>sabretest@wipro.com</ns1:ConversationId>
            <ns1:Service>BargainFinderMax_ADRQ</ns1:Service>
            <ns1:Action>BargainFinderMax_ADRQ</ns1:Action>
            <ns1:MessageData>
                <ns1:MessageId>mid:20001209-133003-2333@resourcecentre.abacus.com.sg</ns1:MessageId>
                <ns1:Timestamp>2007-08-28T11:15:12Z</ns1:Timestamp>
            </ns1:MessageData>
        </ns1:MessageHeader>
        <ns2:Security
            xmlns:ns2="http://schemas.xmlsoap.org/ws/2002/12/secext">
            <ns2:BinarySecurityToken>Shared/IDL:IceSess\/SessMgr:1\.0.IDL/Common/!ICESMS\/CERTG!ICESMSLB\/CRT.LB!1537178481703!2460026!196609</ns2:BinarySecurityToken>
        </ns2:Security>
    </soapenv:Header>
    <soapenv:Body>
        <OTA_AirLowFareSearchRQ ResponseVersion="4.2.0" Version="4.2.0"
            xmlns="http://www.opentravel.org/OTA/2003/05">
            <POS>
                <Source ISOCountry="IN" PseudoCityCode="QI6D">
                    <RequestorID ID="1" Type="1">
                        <CompanyName Code="TN"/>
                    </RequestorID>
                </Source>
            </POS>
            <OriginDestinationInformation>
                <DepartureDateTime>2018-11-30T00:00:00</DepartureDateTime>
                <OriginLocation LocationCode="BLR"/>
                <DestinationLocation LocationCode="MAA"/>
            </OriginDestinationInformation>
            <TravelPreferences>
                <CabinPref Cabin="Y" PreferLevel="Preferred"/>
                <TPA_Extensions>
                    <TripType Value="OneWay"/>
                </TPA_Extensions>
            </TravelPreferences>
            <TravelerInfoSummary>
                <AirTravelerAvail>
                    <PassengerTypeQuantity Code="ADT" Index="0" Quantity="1"/>
                </AirTravelerAvail>
                <PriceRequestInformation NegotiatedFaresOnly="false"/>
            </TravelerInfoSummary>
            <TPA_Extensions>
                <IntelliSellTransaction Debug="false" DisableCache="false" ShowItinSource="false">
                    <RequestType Name="AD1"></RequestType>
                </IntelliSellTransaction>
            </TPA_Extensions>
        </OTA_AirLowFareSearchRQ>
    </soapenv:Body>
</soapenv:Envelope>

Определение класса TransactionTypeRequestType

/**
 * TransactionTypeRequestType.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
 */

package org.opentravel.www.OTA._2003._05;

public class TransactionTypeRequestType  implements java.io.Serializable, org.apache.axis.encoding.SimpleType {
    private java.lang.String name;  // attribute

    public TransactionTypeRequestType() {
    }

    // Simple Types must have a String constructor
    public TransactionTypeRequestType(java.lang.String _value) {
        super();
    }


    /**
     * Gets the name value for this TransactionTypeRequestType.
     * 
     * @return name
     */
    public java.lang.String getName() {
        return name;
    }


    /**
     * Sets the name value for this TransactionTypeRequestType.
     * 
     * @param name
     */
    public void setName(java.lang.String name) {
        this.name = name;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "";
    }

    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {
        if (!(obj instanceof TransactionTypeRequestType)) return false;
        TransactionTypeRequestType other = (TransactionTypeRequestType) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = super.equals(obj) && 
            ((this.name==null && other.getName()==null) || 
             (this.name!=null &&
              this.name.equals(other.getName())));
        __equalsCalc = null;
        return _equals;
    }

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = 1;
        if (getName() != null) {
            _hashCode += getName().hashCode();
        }
        __hashCodeCalc = false;
        return _hashCode;
    }

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(TransactionTypeRequestType.class, true);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("http://www.opentravel.org/OTA/2003/05", ">TransactionType>RequestType"));
        org.apache.axis.description.AttributeDesc attrField = new org.apache.axis.description.AttributeDesc();
        attrField.setFieldName("name");
        attrField.setXmlName(new javax.xml.namespace.QName("", "Name"));
        attrField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        typeDesc.addFieldDesc(attrField);
    }

    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

    /**
     * Get Custom Serializer
     */
    public static org.apache.axis.encoding.Serializer getSerializer(
           java.lang.String mechType, 
           java.lang.Class _javaType,  
           javax.xml.namespace.QName _xmlType) {
        return 
          new  org.apache.axis.encoding.ser.SimpleSerializer(
            _javaType, _xmlType, typeDesc);
    }

    /**
     * Get Custom Deserializer
     */
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType, 
           java.lang.Class _javaType,  
           javax.xml.namespace.QName _xmlType) {
        return 
          new  org.apache.axis.encoding.ser.SimpleDeserializer(
            _javaType, _xmlType, typeDesc);
    }

}

Я был бы очень признателен за любую помощь по этому вопросу

1 Ответ

0 голосов
/ 17 сентября 2018

Кажется, что среда, которую вы пытаетесь использовать для преобразования объекта в XML и наоборот, не имеет сопоставления для класса Object. Этого не должно случиться, если вы используете JAXB или Джексона

...