有人可以帮助我使用JQuery吗?
我想在下面的xml中找到操作名称为Login的元素的soapAction(我已尝试使用方法find但是我没有成功):
<wsdl:definitions name="AuthenticationService" targetNamespace="urn:zeitag.ch.tms.authenticationservice:v1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="urn:zeitag.ch.tms.authenticationservice:v1" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
<wsdl:types>
<xsd:schema targetNamespace="urn:zeitag.ch.tms.authenticationservice:v1/Imports">
<xsd:import schemaLocation="http://localhost:8833/TimeManagementService/Services/AuthenticationService/?xsd=xsd0" namespace="urn:zeitag.ch.tms.authenticationservice:v1"/>
<xsd:import schemaLocation="http://localhost:8833/TimeManagementService/Services/AuthenticationService/?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://localhost:8833/TimeManagementService/Services/AuthenticationService/?xsd=xsd2" namespace="urn:zeitag.ch.tms.entities.authenticationservice:v1"/>
<xsd:import schemaLocation="http://localhost:8833/TimeManagementService/Services/AuthenticationService/?xsd=xsd3" namespace="http://schemas.datacontract.org/2004/07/Ch.ZeitAg.Tms.TimeManagementService.Interface.ServiceEntities.AuthenticationService"/>
<xsd:import schemaLocation="http://localhost:8833/TimeManagementService/Services/AuthenticationService/?xsd=xsd4" namespace="urn:zeitag.ch.tms.entities.common:v1"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="AuthenticationService_GetServiceVersion_InputMessage">
<wsdl:part name="parameters" element="tns:GetServiceVersion"/>
</wsdl:message>
<wsdl:message name="AuthenticationService_GetServiceVersion_OutputMessage">
<wsdl:part name="parameters" element="tns:GetServiceVersionResponse"/>
</wsdl:message>
<wsdl:message name="AuthenticationService_Login_InputMessage">
<wsdl:part name="parameters" element="tns:Login"/>
</wsdl:message>
<wsdl:message name="AuthenticationService_Login_OutputMessage">
<wsdl:part name="parameters" element="tns:LoginResponse"/>
</wsdl:message>
<wsdl:message name="AuthenticationService_Logout_InputMessage">
<wsdl:part name="parameters" element="tns:Logout"/>
</wsdl:message>
<wsdl:message name="AuthenticationService_Logout_OutputMessage">
<wsdl:part name="parameters" element="tns:LogoutResponse"/>
</wsdl:message>
<wsdl:message name="AuthenticationService_TouchSession_InputMessage">
<wsdl:part name="parameters" element="tns:TouchSession"/>
</wsdl:message>
<wsdl:message name="AuthenticationService_TouchSession_OutputMessage">
<wsdl:part name="parameters" element="tns:TouchSessionResponse"/>
</wsdl:message>
<wsdl:portType name="AuthenticationService">
<wsdl:operation name="GetServiceVersion">
<wsdl:input wsaw:Action="urn:zeitag.ch.tms.authenticationservice:v1/AuthenticationService/GetServiceVersion" message="tns:AuthenticationService_GetServiceVersion_InputMessage"/>
<wsdl:output wsaw:Action="urn:zeitag.ch.tms.authenticationservice:v1/AuthenticationService/GetServiceVersionResponse" message="tns:AuthenticationService_GetServiceVersion_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="Login">
<wsdl:input wsaw:Action="urn:zeitag.ch.tms.authenticationservice:v1/AuthenticationService/Login" message="tns:AuthenticationService_Login_InputMessage"/>
<wsdl:output wsaw:Action="urn:zeitag.ch.tms.authenticationservice:v1/AuthenticationService/LoginResponse" message="tns:AuthenticationService_Login_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="Logout">
<wsdl:input wsaw:Action="urn:zeitag.ch.tms.authenticationservice:v1/AuthenticationService/Logout" message="tns:AuthenticationService_Logout_InputMessage"/>
<wsdl:output wsaw:Action="urn:zeitag.ch.tms.authenticationservice:v1/AuthenticationService/LogoutResponse" message="tns:AuthenticationService_Logout_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="TouchSession">
<wsdl:input wsaw:Action="urn:zeitag.ch.tms.authenticationservice:v1/AuthenticationService/TouchSession" message="tns:AuthenticationService_TouchSession_InputMessage"/>
<wsdl:output wsaw:Action="urn:zeitag.ch.tms.authenticationservice:v1/AuthenticationService/TouchSessionResponse" message="tns:AuthenticationService_TouchSession_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_AuthenticationService" type="tns:AuthenticationService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetServiceVersion">
<soap:operation soapAction="urn:zeitag.ch.tms.authenticationservice:v1/AuthenticationService/GetServiceVersion" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Login">
<soap:operation soapAction="urn:zeitag.ch.tms.authenticationservice:v1/AuthenticationService/Login" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Logout">
<soap:operation soapAction="urn:zeitag.ch.tms.authenticationservice:v1/AuthenticationService/Logout" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="TouchSession">
<soap:operation soapAction="urn:zeitag.ch.tms.authenticationservice:v1/AuthenticationService/TouchSession" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AuthenticationService">
<wsdl:port name="BasicHttpBinding_AuthenticationService" binding="tns:BasicHttpBinding_AuthenticationService">
<soap:address location="http://localhost:8833/TimeManagementService/Services/AuthenticationService/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
亲切的问候 马可
答案 0 :(得分:2)
您需要使用find with namespace:
$(xml).find("soap\\:operation[soapAction]")
请在此处查看演示:http://jsfiddle.net/3A23V/
<强> UPDATE1:强> 检查具体行动:
$(xml).find("soap\\:operation[soapAction*='Login']")