当使用 Soap 服务时,结果为空,这就是为什么在 getLastResponse 中填充 XML 的原因。这是 WSDL:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://schema.XXX.com/WebAPI/1.0/Search" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:s1="http://schema.XXX.com/WebAPI/1.0/Common" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://schema.XXX.com/WebAPI/1.0/Search" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">A web service used to perform searches on an instance's data.</wsdl:documentation>
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://schema.XXX.com/WebAPI/1.0/Search">
<s:import namespace="http://schema.XXX.com/WebAPI/1.0/Common" schemaLocation="http://localhost:8090/Services/Common.xsd" />
<s:element name="SearchRequest" type="tns:SearchRequest" />
<s:complexType name="SearchRequest">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="Contexts" type="s1:FilterContext" />
</s:sequence>
</s:complexType>
<s:element name="SearchResponse" type="tns:SearchResponse" />
<s:complexType name="SearchResponse">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="Items" type="tns:SearchResultItem" />
<s:element minOccurs="0" maxOccurs="1" name="Status" type="s1:SoapResponseStatus" />
</s:sequence>
</s:complexType>
<s:complexType name="SearchResultItem">
<s:complexContent mixed="false">
<s:extension base="s1:ItemKey">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="DisplayName" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="ResultType" type="s1:FilterContextType" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name="SearchSoapIn">
<wsdl:part name="Request" element="tns:SearchRequest" />
</wsdl:message>
<wsdl:message name="SearchSoapOut">
<wsdl:part name="SearchResult" element="tns:SearchResponse" />
</wsdl:message>
<wsdl:portType name="SearchWebServiceSoap">
<wsdl:operation name="Search">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Performs a search based on requested contexts and filters.</wsdl:documentation>
<wsdl:input message="tns:SearchSoapIn" />
<wsdl:output message="tns:SearchSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SearchWebServiceSoap" type="tns:SearchWebServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Search">
<soap:operation soapAction="http://schema.XXX.com/WebAPI/1.0/Search/Search" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="SearchWebServiceSoap12" type="tns:SearchWebServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Search">
<soap12:operation soapAction="http://schema.XXX.com/WebAPI/1.0/Search/Search" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SearchWebService">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">A web service used to perform searches on an instance's data.</wsdl:documentation>
<wsdl:port name="SearchWebServiceSoap" binding="tns:SearchWebServiceSoap">
<soap:address location="http://localhost:50295/Services/SearchWebService.asmx" />
</wsdl:port>
<wsdl:port name="SearchWebServiceSoap12" binding="tns:SearchWebServiceSoap12">
<soap12:address location="http://localhost:50295/Services/SearchWebService.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
<?xml version="1.0" encoding="utf-8"?>
<s:schema xmlns="http://schema.XXX.com/WebAPI/1.0/Common"
xmlns:s="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
targetNamespace="http://schema.XXX.com/WebAPI/1.0/Common">
<s:complexType name="ItemKey">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="SiteId" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="ItemId" type="s:int" />
</s:sequence>
</s:complexType>
<s:complexType name="SoapResponseStatus">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="Succeeded" type="s:boolean" />
<s:element minOccurs="1" maxOccurs="1" name="ErrorCode" type="s:int" />
</s:sequence>
</s:complexType>
<s:complexType name="ItemKeyRequest">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Key" type="ItemKey" />
</s:sequence>
</s:complexType>
<s:complexType name="FilterContext">
<s:complexContent mixed="false">
<s:extension base="IFilter">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="ContextType" type="FilterContextType" />
<s:element minOccurs="0" maxOccurs="1" name="FilterGroup" type="FilterGroup" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
<s:complexType name="IFilter" abstract="true" />
<s:complexType name="FilterValue">
<s:complexContent mixed="false">
<s:extension base="IFilter">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Key" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="OperatorType" type="OperatorType" />
<s:element minOccurs="0" maxOccurs="1" name="Value" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="SchemaTypeName" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="SchemaTypeNamespace" type="s:string" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
<s:simpleType name="OperatorType">
<s:restriction base="s:string">
<s:enumeration value="NotSet" />
<s:enumeration value="Equal" />
<s:enumeration value="GreaterThan" />
<s:enumeration value="LessThan" />
<s:enumeration value="GreaterThanEqual" />
<s:enumeration value="LessThanEqual" />
<s:enumeration value="Contains" />
<s:enumeration value="StartsWith" />
<s:enumeration value="EndsWith" />
</s:restriction>
</s:simpleType>
<s:complexType name="FilterContainer">
<s:complexContent mixed="false">
<s:extension base="IFilter">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="FilterValue" type="FilterValue" />
<s:element minOccurs="0" maxOccurs="1" name="FilterGroup" type="FilterGroup" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
<s:complexType name="FilterGroup">
<s:complexContent mixed="false">
<s:extension base="IFilter">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="GroupType" type="FilterGroupType" />
<s:element minOccurs="0" maxOccurs="unbounded" name="Filters" type="FilterContainer" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
<s:simpleType name="FilterGroupType">
<s:restriction base="s:string">
<s:enumeration value="And" />
<s:enumeration value="Or" />
</s:restriction>
</s:simpleType>
<s:simpleType name="FilterContextType">
<s:restriction base="s:string">
<s:enumeration value="Hierarchy" />
<s:enumeration value="ReportDefinition" />
<s:enumeration value="GeneratedReport" />
<s:enumeration value="Role" />
<s:enumeration value="User" />
</s:restriction>
</s:simpleType>
</s:schema>
PHP 代码:
$client = new SoapClient("SearchWebService.wsdl", array('location' => "$usingSSL://$hostname/axis2/services/SearchWebService", 'trace' => 1, 'exceptions' => 1));
$data = json_decode(stripslashes($_POST["data"]));
$result = $client->Search($data);
__getLastResponse:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<n:SearchResponse xmlns:n="http://schema.XXX.com/WebAPI/1.0/Search" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:n0="http://schema.XXX.com/WebAPI/1.0/Common">
<n:Responses>
<n:Items>
<n0:SiteId/>
<n0:ItemId>22</n0:ItemId>
<n:DisplayName>Floor 1</n:DisplayName>
<n:ResultType>Hierarchy</n:ResultType>
</n:Items>
<n:Items>
<n0:SiteId/>
<n0:ItemId>196</n0:ItemId>
<n:DisplayName>Floor 1</n:DisplayName>
<n:ResultType>Hierarchy</n:ResultType>
</n:Items>
<n:Status>
<n0:Succeeded>true</n0:Succeeded>
<n0:ErrorCode>0</n0:ErrorCode>
</n:Status>
</n:Responses>
</n:SearchResponse>
</soapenv:Body>
</soapenv:Envelope>
$result 始终为空。没有错误。我尝试了类图和相同的结果。
有什么想法吗?
最佳答案
尝试对结果进行 var_dump()...您看到了什么?
此外,您也可以尝试这个,将其包装在搜索调用周围:
try {
$result = $client->Search($data);
} catch (SoapFault $exception) {
//We errored
echo $exception;
}
关于PHP 5 soapClient 结果为空 __getLastResponse 显示正确的 XML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12047882/
我得到了一个包含嵌套链接的表单。编辑时链接字段为空的问题。这是我的表格:Editingkategori{:action=>'update',:id=>@konkurrancer.id})do|f|%>'Trackingurl',:style=>'width:500;'%>'Editkonkurrence'%>|我的konkurrencer模型:has_one:link我的链接模型:classLink我的konkurrancer编辑操作:defedit@konkurrancer=Konkurrancer.find(params[:id])@konkurrancer.link_attrib
我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i
我有一个对象has_many应呈现为xml的子对象。这不是问题。我的问题是我创建了一个Hash包含此数据,就像解析器需要它一样。但是rails自动将整个文件包含在.........我需要摆脱type="array"和我该如何处理?我没有在文档中找到任何内容。 最佳答案 我遇到了同样的问题;这是我的XML:我在用这个:entries.to_xml将散列数据转换为XML,但这会将条目的数据包装到中所以我修改了:entries.to_xml(root:"Contacts")但这仍然将转换后的XML包装在“联系人”中,将我的XML代码修改为
我希望我的UserPrice模型的属性在它们为空或不验证数值时默认为0。这些属性是tax_rate、shipping_cost和price。classCreateUserPrices8,:scale=>2t.decimal:tax_rate,:precision=>8,:scale=>2t.decimal:shipping_cost,:precision=>8,:scale=>2endendend起初,我将所有3列的:default=>0放在表格中,但我不想要这样,因为它已经填充了字段,我想使用占位符。这是我的UserPrice模型:classUserPrice回答before_val
所以我在关注Railscast,我注意到在html.erb文件中,ruby代码有一个微弱的背景高亮效果,以区别于其他代码HTML文档。我知道Ryan使用TextMate。我正在使用SublimeText3。我怎样才能达到同样的效果?谢谢! 最佳答案 为SublimeText安装ERB包。假设您安装了SublimeText包管理器*,只需点击cmd+shift+P即可获得命令菜单,然后键入installpackage并选择PackageControl:InstallPackage获取包管理器菜单。在该菜单中,键入ERB并在看到包时选择
我试图在索引页中创建一个超链接,但它没有显示,也没有给出任何错误。这是我的index.html.erb代码。ListingarticlesTitleTextssss我检查了我的路线,我认为它们也没有问题。PrefixVerbURIPatternController#Actionwelcome_indexGET/welcome/index(.:format)welcome#indexarticlesGET/articles(.:format)articles#indexPOST/articles(.:format)articles#createnew_articleGET/article
我是rails的新手,想在form字段上应用验证。myviewsnew.html.erb.....模拟.rbclassSimulation{:in=>1..25,:message=>'Therowmustbebetween1and25'}end模拟Controller.rbclassSimulationsController我想检查模型类中row字段的整数范围,如果不在范围内则返回错误信息。我可以检查上面代码的范围,但无法返回错误消息提前致谢 最佳答案 关键是您使用的是模型表单,一种显示ActiveRecord模型实例属性的表单。c
导读语言模型给我们的生产生活带来了极大便利,但同时不少人也利用他们从事作弊工作。如何规避这些难辨真伪的文字所产生的负面影响也成为一大难题。在3月9日智源Live第33期活动「DetectGPT:判断文本是否为机器生成的工具」中,主讲人Eric为我们讲解了DetectGPT工作背后的思路——一种基于概率曲率检测的用于检测模型生成文本的工具,它可以帮助我们更好地分辨文章的来源和可信度,对保护信息真实、防止欺诈等方面具有重要意义。本次报告主要围绕其功能,实现和效果等展开。(文末点击“阅读原文”,查看活动回放。)Ericmitchell斯坦福大学计算机系四年级博士生,由ChelseaFinn和Chri
目前,Itembelongs_toCompany和has_manyItemVariants。我正在尝试使用嵌套的fields_for通过Item表单添加ItemVariant字段,但是使用:item_variants不显示该表单。只有当我使用单数时才会显示。我检查了我的关联,它们似乎是正确的,这可能与嵌套在公司下的项目有关,还是我遗漏了其他东西?提前致谢。注意:下面的代码片段中省略了不相关的代码。编辑:不知道这是否相关,但我正在使用CanCan进行身份验证。routes.rbresources:companiesdoresources:itemsenditem.rbclassItemi
如果我在模型中设置验证消息validates:name,:presence=>{:message=>'Thenamecantbeblank.'}我如何让该消息显示在闪光警报中,这是我迄今为止尝试过的方法defcreate@message=Message.new(params[:message])if@message.valid?ContactMailer.send_mail(@message).deliverredirect_to(root_path,:notice=>"Thanksforyourmessage,Iwillbeintouchsoon")elseflash[:error]