标签: response

如何从ruby客户端解析SOAP响应?

我正在学习Ruby,我编写了以下代码来了解如何使用SOAP服务:

require 'soap/wsdlDriver'
wsdl="http://www.abundanttech.com/webservices/deadoralive/deadoralive.wsdl"
service=SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
weather=service.getTodaysBirthdays('1/26/2010')
Run Code Online (Sandbox Code Playgroud)

我得到的回应是:

#<SOAP::Mapping::Object:0x80ac3714 
{http://www.abundanttech.com/webservices/deadoralive} getTodaysBirthdaysResult=#<SOAP::Mapping::Object:0x80ac34a8 
{http://www.w3.org/2001/XMLSchema}schema=#<SOAP::Mapping::Object:0x80ac3214 
{http://www.w3.org/2001/XMLSchema}element=#<SOAP::Mapping::Object:0x80ac2f6c 
{http://www.w3.org/2001/XMLSchema}complexType=#<SOAP::Mapping::Object:0x80ac2cc4 
{http://www.w3.org/2001/XMLSchema}choice=#<SOAP::Mapping::Object:0x80ac2a1c 
{http://www.w3.org/2001/XMLSchema}element=#<SOAP::Mapping::Object:0x80ac2774 
{http://www.w3.org/2001/XMLSchema}complexType=#<SOAP::Mapping::Object:0x80ac24cc 
{http://www.w3.org/2001/XMLSchema}sequence=#<SOAP::Mapping::Object:0x80ac2224 
{http://www.w3.org/2001/XMLSchema}element=[#<SOAP::Mapping::Object:0x80ac1f7c>, 
#<SOAP::Mapping::Object:0x80ac13ec>, 
#<SOAP::Mapping::Object:0x80ac0a28>, 
#<SOAP::Mapping::Object:0x80ac0078>, 
#<SOAP::Mapping::Object:0x80abf6c8>, 
#<SOAP::Mapping::Object:0x80abed18>]
>>>>>>> {urn:schemas-microsoft-com:xml-diffgram-v1}diffgram=#<SOAP::Mapping::Object:0x80abe6c4 
{}NewDataSet=#<SOAP::Mapping::Object:0x80ac1220 
{}Table=[#<SOAP::Mapping::Object:0x80ac75e4 
{}FullName="Cully,  Zara" 
{}BirthDate="01/26/1892" 
{}DeathDate="02/28/1979" 
{}Age="(87)" 
{}KnownFor="The Jeffersons" 
{}DeadOrAlive="Dead">, 
#<SOAP::Mapping::Object:0x80b778f4 
{}FullName="Feiffer, Jules" 
{}BirthDate="01/26/1929" 
{}DeathDate=#<SOAP::Mapping::Object:0x80c7eaf4> 
{}Age="81" 
{}KnownFor="Cartoonists" 
{}DeadOrAlive="Alive">]>>>>
Run Code Online (Sandbox Code Playgroud)

我有困难的很大搞清楚如何分析并显示在一个不错的表返回的信息,或甚至只是如何通过记录回路,并已获得各元素(即全名,年龄等).我经历了整个去"getTodaysBirthdaysResult.methods - Object.new.methods",并一直工作到尝试找出如何访问的元素,但后来我到阵列和我迷路了.

任何可以提供的帮助将不胜感激.

ruby soap wsdl response request

3
推荐指数
1
解决办法
5589
查看次数

纯文本JSP响应

我坚持这个问题.答案可能是直截了当的,但对于我的生活,我无法弄清楚.

这是我非常简单的jsp文件:

<%@page contentType="text/plain" 
import="java.util.*" 
import="subscriberapi.SubscriberAPI"
pageEncoding="UTF-8"%>
<%!private String Check(String jsonText)
{
    SubscriberAPI subscriberAPI = new SubscriberAPI();
    return subscriberAPI.Check(jsonText);
}%>
<%response.setContentType("text/plain");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("pragma","no-cache");%>
<%=Check(request.getParameter("jsonText"))%>
Run Code Online (Sandbox Code Playgroud)

我希望输出为:

{"Status":true,"Message":"All good"}
Run Code Online (Sandbox Code Playgroud)

但我得到的输出是:

<html>
<head></head>
<body>
<pre style="word-wrap: break-word; white-space: pre-wrap;">{"Status":true,"Message":"All good"}</pre>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

它在浏览器中看起来是正确的,但实际响应转到另一个不需要html的进程.

如何绕过响应摆脱html构建?这是由Glassfish设定的吗?

jsp response glassfish plaintext

3
推荐指数
1
解决办法
7695
查看次数

MVC 3 Response.Flush不起作用

我有下一个代码:

@{ Layout = null; }
@Html.Raw(ViewBag.ReportHeader as string)
@{
    Response.Buffer = true;
    Response.Flush();
}
@Html.Raw(ViewBag.ReportBodyAndFoot as string)
Run Code Online (Sandbox Code Playgroud)

在这种情况下,我希望首先呈现页面的标题,然后使用页脚呈现主体,但响应发送整个页面.

asp.net-mvc response razor

3
推荐指数
1
解决办法
3151
查看次数

我们可以使用Response.Flush()而不是Response.End()

Response.End()生成ThreadAbortException.

HttpContext.Current.ApplicationInstance.CompleteRequest它代替它并不能解决问题.

那么,我们可以使用Response.Flush()而不是Response.End()

c# asp.net response.redirect response httpcontext

3
推荐指数
1
解决办法
2万
查看次数

使用php ping一个ip并导致平均响应时间.

任何人都知道一个简单的方法来ping一个php中的IP地址并回显平均ping时间的结果吗?

例如,当我真正想要的是"35"时,我会得到"最小值= 35毫秒,最大值= 35毫秒,平均值= 35毫秒"

谢谢.

php ip parsing ping response

3
推荐指数
2
解决办法
4967
查看次数

BackboneJS .fetch()在响应中放置一个对象

我的服务器响应有两个对象(图片): 在此输入图像描述

我怎样才能在我的Backbone Collection中放置对象成员(模型).我正在使用collection.fetch从服务器获取数据.我能否以某种方式添加我的服务器响应.

response fetch backbone.js

3
推荐指数
1
解决办法
1662
查看次数

node.js:具有正确标头的浏览器图像缓存

我正在开发一个管理大量图像,存储和调整大小的Web应用程序.

图像的请求类似于:domain:port/image_id/size

服务器获取image_id,如果还没有这样大小的图像,则创建它并将其存储在文件系统上.

所以一切正常,服务器正在运行,但我需要在浏览器中缓存这些图像至少一天,以减少服务器带宽消耗.

我做了几次测试,但似乎没有任何效果.

这是我用来制作响应头的代码:

response.writeHead(304, {
          "Pragma": "public",
          "Cache-Control": "max-age=86400",
          "Expires": new Date(Date.now() + 86400000).toUTCString(),
          "Content-Type": contentType});
    response.write(data);
    response.end();
Run Code Online (Sandbox Code Playgroud)

我也尝试了响应状态200. contentType总是像mime类型,如"image/jpg"或"image/png"数据是图像的字节缓冲区.

有什么建议?非常感谢.

健康长寿·繁荣昌盛,

d.

response http-caching image-caching offline-caching node.js

3
推荐指数
1
解决办法
6909
查看次数

AFNetworking 2 - 获取错误json正文

我正在使用最新的AFNetworking为我的应用程序与REST API服务器说话.

当我500从JSON主体那里得到一些错误时

{ "message": "my error message" },

我无法检索NSErrorlib响应我的消息:

[api setupUser:data success:^(AFHTTPRequestOperation *operation, id responseObject) {
   // some success handle
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
   // cannot get json response of error :(
}];
Run Code Online (Sandbox Code Playgroud)

你是如何解决它的?

error-handling json response objective-c afnetworking-2

3
推荐指数
1
解决办法
2100
查看次数

调用response.getStatus()时发生NoSuchMethodError

我想这是某种依赖性问题,所以这是我的树:

[INFO] Sikor:BrowserGame:war:1.0-SNAPSHOT
[INFO] +- junit:junit:jar:3.8.1:test
[INFO] +- org.springframework:spring-context:jar:4.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:4.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:4.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-core:jar:4.1.1.RELEASE:compile
[INFO] |  |  \- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] |  \- org.springframework:spring-expression:jar:4.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.1.1.RELEASE:compile
[INFO] |  \- org.springframework:spring-web:jar:4.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:4.1.1.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-web:jar:3.2.5.RELEASE:compile
[INFO] |  +- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  \- org.springframework.security:spring-security-core:jar:3.2.5.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-config:jar:3.2.5.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-taglibs:jar:3.2.5.RELEASE:compile
[INFO] |  \- org.springframework.security:spring-security-acl:jar:3.2.5.RELEASE:compile
[INFO] +- org.thymeleaf:thymeleaf-spring4:jar:2.1.3.RELEASE:compile
[INFO] |  \- org.thymeleaf:thymeleaf:jar:2.1.3.RELEASE:compile
[INFO] |     +- ognl:ognl:jar:3.0.6:compile
[INFO] |     \- org.unbescape:unbescape:jar:1.0:compile
[INFO] +- org.thymeleaf.extras:thymeleaf-extras-springsecurity3:jar:2.1.1.RELEASE:compile
[INFO] …
Run Code Online (Sandbox Code Playgroud)

java spring servlets response

3
推荐指数
1
解决办法
4005
查看次数

在Xamarin.Android中解析json请求

我搜索了很长时间但没有成功......

我想解析Xamarin.Android中API的json响应.

我的json响应是这样的:

[
  {
    "id": "21",
    "date": "2018-01-01",
    "name": "Name1"
  },
  {
    "id": "22",
    "date": "2018-01-02",
    "name": "Name2",
  }
]
Run Code Online (Sandbox Code Playgroud)

如您所见,它包含2行.行的数量可以改变.有时有6行但有时只有2行......

所以我想获得每一行的每个id,日期和名称标签的值.我尝试了每个循环,但没有成功...

有人可以帮我使用DataSet和DataTable吗?

我看到了这段代码,但是DataSet和DataTable出错了:

string json = @"{
  'Table1': [
    {
      'id': 0,
      'item': 'item 0'
    },
    {
      'id': 1,
      'item': 'item 1'
    }
  ]
}";

DataSet dataSet = JsonConvert.DeserializeObject<DataSet>(json);

DataTable dataTable = dataSet.Tables["Table1"];

Console.WriteLine(dataTable.Rows.Count);
// 2

foreach (DataRow row in dataTable.Rows)
{
    Console.WriteLine(row["id"] + " - " + row["item"]);
}
// 0 - item 0
// 1 - …
Run Code Online (Sandbox Code Playgroud)

c# json response xamarin.android xamarin

3
推荐指数
1
解决办法
282
查看次数