Java POJO对象(XML)android的RequestBody实现
嗨,我想为我的soap服务器制作api,用php为android编写,并带有改装库 我已经创建了一个接口Java POJO对象(XML)android的RequestBody实现,java,android,soap,retrofit,okhttp,Java,Android,Soap,Retrofit,Okhttp,嗨,我想为我的soap服务器制作api,用php为android编写,并带有改装库 我已经创建了一个接口 public interface SoapApi { @Headers({ "Content-Type: application/soap+xml", "Accept-Charset: utf-8" }) @POST("/index.php") public DeviceCredentials test(@Bod
public interface SoapApi {
@Headers({
"Content-Type: application/soap+xml",
"Accept-Charset: utf-8"
})
@POST("/index.php")
public DeviceCredentials test(@Body RequestEnvelope body);
}
和每个api请求的RequestEnvelope
@Root(name = "Envelope")
@NamespaceList({
@Namespace(reference = "http://www.w3.org/2001/XMLSchema", prefix = "s"),
@Namespace(reference = "http://schemas.xmlsoap.org/soap/encoding/", prefix = "soapenc"),
@Namespace(reference = "http://schemas.xmlsoap.org/wsdl/soap/", prefix = "soap"),
@Namespace(reference = "http://schemas.xmlsoap.org/wsdl/", prefix = "wsdl")
})
public class RequestEnvelope {
@Element(name = "Body")
private RequestBody aBody;
public RequestBody getBody(){
return aBody;
}
public void setBody(RequestBody body){
aBody = body;
}
}
还有我的POJO班
@Root(name = "DeviceCredentials")
public class DeviceCredentials {
@Element(name="UUID")
public String UUID;
@Element(name="OSType")
public String OSType;
}
我想将DeviceCredentials类设置为requestEnvelope的主体,但我不知道如何创建RequestBody实现来发出正确的请求
你能帮我吗