Hallo Ich versuche Retrofit zu verwenden, um einen einfachen Rest-Client zu schreiben, ich versuche, eine REST API GET aufzurufen, die eine XML-Antwort zurückgibt, jedoch nachrüsten ist nicht in der Lage, das XML zu analysieren.Retrofit kann nicht in xml in java konvertieren.Wie man xml in java konvertiert mit retrofit2
Retrofit-Code
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(API_URL)
.addConverterFactory(SimpleXmlConverterFactory.create())
.build();
// Create an instance of our OfferClient API interface.
OfferClient offerClient = retrofit.create(OfferClient.class);
// Create a call instance for looking up offers.
String offerID="20000798";
Call<Offer> call = offerClient.offers(offerID);
Offer offer = call.execute().body();
System.out.println("Offer Response..."+ offer.getDescription());
Exception in thread "main" java.lang.RuntimeException: org.simpleframework.xml.core.ElementException: Element 'featureSetID' keine Übereinstimmung in der Klasse haben com.intuit.schema.platform.webs.catalog.internal.offers.v3.Offer $ Produkt in Zeile 1 bei retrofit2.converter.simplexml.SimpleXmlResponseBodyConverter.convert (SimpleXmlResponseBodyConverter.java:44) bei
012.351.
Antwort, die nicht unrangiert werden konnte.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<offer xmlns="http://schema.intuit.com/platform/webs/catalog/internal/offers/v3">
<offerID>20000798</offerID>
<name>QBOA + QBO Plus + QBOP Enhanced CA CAD for Accountants</name>
<description>QBOA + QBO Plus + QBOP Enhanced CA CAD for Accountants</description>
<effectiveStartDate>2015-12-13T00:00:00-0800</effectiveStartDate>
<currency>CAD</currency>
<region>CA</region>
<country>CA</country>
<offerType>Free</offerType>
<offerLevel>BASE</offerLevel>
<customerSegment>ACCOUNTANT</customerSegment>
<extendedCustomerSegment>REGULAR</extendedCustomerSegment>
<salesChannel>DIRECT</salesChannel>
<isListPriceOffer>true</isListPriceOffer>
<product>
<productID>22000220</productID>
<packageId>21001070</packageId>
<code>QBOA</code>
<name>QuickBooks Online Accountant</name>
<description>QuickBooks Online Accountant</description>
<grantOfferingType>Intuit.smallbusiness.qba.web</grantOfferingType>
<billingServiceType>/service/intuit/qboa</billingServiceType>
<featureSet>
<featureSetID>25001595</featureSetID>
<code>QBOA_STANDARD</code>
<name>QBO Accountant Standard</name>
<status>Active</status>
<description>QuickBooks Online Accountant Standard</description>
<feature>
<code>STANDARD</code>
<name>Standard</name>
<type>Feature Set</type>
</feature>
</featureSet>
<charge>
<chargeID>23001499</chargeID>
<name>QuickBooks Online Accountant Standard</name>
<description>QuickBooks Online Accountant Standard CA CAD Monthly Free</description>
<type>Recurring</type>
</charge>
</product>
<product>
<productID>22000000</productID>
<packageId>21001071</packageId>
<code>QBO</code>
<name>QuickBooks Online</name>
<description>QuickBooks Online</description>
<grantOfferingType>Intuit.sbe.salsa.default</grantOfferingType>
<billingServiceType>/service/intuit/qbo</billingServiceType>
<featureSet>
<featureSetID>25000000</featureSetID>
<code>QBO_PLUS</code>
<name>QBO_PLUS</name>
<status>Active</status>
<description>QuickBooks Online Plus</description>
<feature>
<code>PLUS</code>
<name>Plus</name>
<type>Feature Set</type>
</feature>
</featureSet>
<charge>
<chargeID>23001500</chargeID>
<name>QuickBooks Online Plus</name>
<description>QuickBooks Online Plus Accountant CA CAD Monthly Free</description>
<type>Recurring</type>
</charge>
</product>
<product>
<productID>22000154</productID>
<dependentOnProductId>22000000</dependentOnProductId>
<dependentOnProductCode>QBO</dependentOnProductCode>
<packageId>21001323</packageId>
<code>QBOP</code>
<name>QuickBooks Online Payroll</name>
<description>QuickBooks Online Payroll</description>
<grantOfferingType>Intuit.ems.iop</grantOfferingType>
<billingServiceType>/service/intuit/qbo/qbop</billingServiceType>
<featureSet>
<featureSetID>25000537</featureSetID>
<code>ENHANCED</code>
<name>ENHANCED</name>
<status>Active</status>
<description>ENHANCED</description>
<feature>
<code>ENHANCED</code>
<name>Enhanced</name>
<type>Feature Set</type>
</feature>
</featureSet>
<charge>
<chargeID>23001868</chargeID>
<name>QuickBooks Online Payroll Enhanced</name>
<description>QuickBooks Online Payroll Enhanced CA CAD Monthly Free</description>
<type>Recurring</type>
</charge>
<charge>
<chargeID>23001964</chargeID>
<name>QuickBooks Online Payroll Enhanced Usage</name>
<description>QuickBooks Online Payroll Enhanced Accountant CA CAD Usage Free</description>
<type>Usage</type>
</charge>
</product>
<transition>
<transitionType>Resubscribe</transitionType>
<fromOfferID>20000798</fromOfferID>
<toOfferID>20000798</toOfferID>
</transition>
</offer>
Dies liefert keine Antwort auf die Frage. Sobald Sie genügend [Reputation] (http://stackoverflow.com/help/whats-reputation) haben, können Sie [jeden Beitrag kommentieren] (http://stackoverflow.com/help/privileges/comment); stattdessen [geben Sie Antworten, die keine Klärung durch den Fragesteller erfordern] (http://meta.stackexchange.com/questions/214173/why-doe-i-need-50-reputation-to-comment-what-can- i-do-stattdessen). – Raju
versuchen Sie, Ihren Beitrag zu verbessern, indem Sie auf [Bearbeiten] (http://stackoverflow.com/posts/37256147/edit) Link direkt unter dem Beitrag klicken. Kommentar unterstützt keine Codeformatierungsfunktionen. – Raju