我正在尝试使用网络服务(Sabre的 BargainFinderMaxService_ADRQ服务),但遇到了问题。我已导入WSDL文件并生成了Java类。我无法连接到Web服务并收到异常。
WSDL文件:http://files.developer.sabre.com/wsdl/sabreXML1.0.00/shopping/BargainFinderMax_ADRQ_v4-2-0.wsdl
客户代码(如果我们发表评论,则不会出现此行异常,但是该参数是必需的:- transactionTypeRequestType.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);
}
}
非常感谢您对此问题的帮助
答案 0 :(得分:0)
似乎您试图用来将对象转换为XML的框架,反之亦然,该框架没有Object类的映射。 如果您使用JAXB或杰克逊,那应该不会发生