Java 如何创建包含模式的改装soap请求对象?
我有一个请求Java 如何创建包含模式的改装soap请求对象?,java,android,xml,soap,retrofit2,Java,Android,Xml,Soap,Retrofit2,我有一个请求xml,其中包含模式定义。如何创建需要传递给改造soap请求的pojo类 下面是我的示例xml数据,需要创建为pojo <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <soap:Header /> <soap:Bo
xml
,其中包含模式定义。如何创建需要传递给改造soap请求的pojo类
下面是我的示例xml
数据,需要创建为pojo
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<soap:Header />
<soap:Body>
<gbr xmlns="http://tempuri.org/">
<objhandler>
<id>
<int>123</int>
</id>
<dp>true</dp>
<cid>12312</cid>
</objhandler>
<dtASNCondensed>
<xs:schema xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:xs="http://www.w3.org/2001/XMLSchema" id="NewDataSet" xmlns="">
<xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:MainDataTable="dtASNCondensed" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element name="dtASNCondensed">
<xs:complexType>
<xs:sequence>
<xs:element name="id" minOccurs="0" type="xs:string" />
<xs:element name="gid" minOccurs="0" type="xs:string" />
<xs:element name="te" minOccurs="0" type="xs:string" />
<xs:element name="rec" minOccurs="0" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<DocumentElement xmlns="">
<dtASNCondensed diffgr:hasChanges="inserted" diffgr:id="dtASNCondensed1"
msdata:rowOrder="0">
<id>123</id>
<gid>3000037430</gid>
<te>102</te>
<rec>1</rec>
</dtASNCondensed>
</DocumentElement>
</diffgr:diffgram>
</dtASNCondensed>
</gbr>
</soap:Body>
123
真的
12312
123
3000037430
102
1.
您可以使用简单的xml库来完成,您可以像这样构建您的改型
retrofit = new Retrofit.Builder()
.addConverterFactory(SimpleXmlConverterFactory.create(serializer))
.baseUrl("http://www.webservicex.net/")
.client(okHttpClient)
.build();
有关更多详细信息,您可以查看此示例Hi Krutik,我的应用程序已经启动并正在运行,并已实施改装。我的问题是为前面提到的xml创建一个请求对象。