我正在使用Retrofit 2.2.0和Retrofit SimpleXML Converter 2.2.0.我用方法添加SimpleXmlConverter到Retrofit实例中addConverterFactory.
问题是,当我收到响应时,它会收到以下错误
java.lang.RuntimeException:org.simpleframework.xml.core.ElementException:元素'Body'在第1行的ResponseEnvelope类中没有匹配项
我应该得到这样的XML响应:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:autenticarUsuarioPorEmailResponse xmlns:ns="http://business.curitiba.org.br">
<ns:return xsi:type="ax2471:AutenticaUsuarioPorEmailSaida" xmlns:ax2471="http://saidas.curitiba.org/xsd" xmlns:ax2469="http://entities.curitiba.org/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ax2467="http://entradas.curitiba.org/xsd">
<ax2471:idCredencial>3282</ax2471:idCredencial>
<ax2471:tokenAcesso>635E3DA9-7C02-4DB7-9653-E7688C66B02C</ax2471:tokenAcesso>
</ns:return>
</ns:autenticarUsuarioPorEmailResponse>
</soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)
@Root(name = "soapenv:Envelope")
@Namespace(prefix = "soapenv", reference = "http://schemas.xmlsoap.org/soap/envelope/")
public class ResponseEnvelope {
@Element(name = "soapenv:Body", required = false)
private ResponseBody body;
public ResponseBody getBody() {
return body;
}
public void setBody(ResponseBody body) {
this.body = body;
}
}
Run Code Online (Sandbox Code Playgroud)
@Root(name = "soapenv:Body", strict = false)
public class …Run Code Online (Sandbox Code Playgroud) 我有一个共享主机,我正在尝试让我的 laravel 项目在其上运行,我正在使用 voyager 进行管理面板。
我将我的应用程序公共文件夹放在 /public_html 中,并将项目的其余部分放在 /public_html 的同一级别上,所以它看起来像这样:
.bash_history
.bash_logout
.bash_profile
.bashrc
.cache
.cpanel
.htpasswds
logs
mail
app -> my project
public_ftp
public_html -> where my app public folder is
.ssh
tmp
etc
...
Run Code Online (Sandbox Code Playgroud)
我几乎完成了所有工作,但管理面板无法正常工作。
当我访问 www.example.com/admin 时,它会转到 www.example.com/admin/login,我输入凭据并提交表单,在它返回到同一页面后,然后我检查了 Chrome 上的网络选项卡,它出现以下消息:
Request URL: http://example.com/admin/login
Request Method: GET
Status Code: 403 Forbidden
Run Code Online (Sandbox Code Playgroud)
有人知道如何修复它吗?
谢谢。
我正在使用Retrofit 2开发一个应用程序以请求API。该API位于ASP.NET中,并且使用GZip压缩并编码为Base64,如以下代码所示:
private static string Compress(string conteudo)
{
Encoding encoding = Encoding.UTF8;
byte[] raw = encoding.GetBytes(conteudo);
using (var memory = new MemoryStream())
{
using (GZipStream gzip = new GZipStream(memory, CompressionMode.Compress, true))
{
gzip.Write(raw, 0, raw.Length);
}
return Convert.ToBase64String(memory.ToArray());
}
}
private static string Decompress(string conteudo)
{
Encoding encoding = Encoding.UTF8;
var gzip = Convert.FromBase64String(conteudo);
using (GZipStream stream = new GZipStream(new MemoryStream(gzip), CompressionMode.Decompress))
{
int size = gzip.Length;
byte[] buffer = new byte[size];
using (MemoryStream memory = new MemoryStream())
{
int …Run Code Online (Sandbox Code Playgroud)