b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

使用SoapUI调用Vsphere Web Service

电脑杂谈  发布时间:2020-02-16 01:00:31  来源:网络整理

soapui wsdl_soapui生成wsdl文件_soapui调用wsdl需要安全验证

项目中频繁需要调用Webservice进行验证检测soapui调用wsdl需要安全验证,下面就介绍下怎样使用检测软件SoapUI调用Vsphere vcenter的 Web Service

VSphere的Webservice地址默认为

Request内容如下:

技术分享技术分享

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">
   <soapenv:Header/>
   
   <soapenv:Body>
      <urn:Login>
         <urn:_this type="SessionManager">SessionManager</urn:_this>
         <urn:userName>[email protected]</urn:userName>
         <urn:password>密码</urn:password>
         <!--Optional:-->
         <urn:locale>?</urn:locale>
      </urn:Login>
   </soapenv:Body>
</soapenv:Envelope>

soapui调用wsdl需要安全验证_soapui生成wsdl文件_soapui wsdl

View Code

Response内容如下:

技术分享技术分享

<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <LoginResponse xmlns="urn:vim25">
         <returnval>
            <key>52c8ab58-eb03-e526-c733-5051d62652b6</key>
            <userName>VSPHERE.LOCAL\Administrator</userName>
            <fullName>Administrator vsphere.local</fullName>
            <loginTime>2016-08-15T09:19:39.526713Z</loginTime>
            <lastActiveTime>2016-08-15T09:19:39.526713Z</lastActiveTime>
            <locale>?</locale>
            <messageLocale>zh_CN</messageLocale>
            <extensionSession>false</extensionSession>
            <ipAddress>10.200.108.92</ipAddress>
            <userAgent>Apache-HttpClient/4.1.1 (java 1.5)</userAgent>
            <callCount>0</callCount>
         </returnval>
      </LoginResponse>
   </soapenv:Body>
</soapenv:Envelope>

View Code

soapui调用wsdl需要安全验证_soapui wsdl_soapui生成wsdl文件

注意:需要记录response中的header信息,用于前面设置header,我这儿的header信息如下

Set-Cookie vmware_soap_session="52f2ce6a-8ce9-94cc-bd62-3f750d61cd4f"; Path=/; HttpOnly; Secure;

Request内容如下:

技术分享技术分享

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">
<soapenv:Header>
</soapenv:Header>
   <soapenv:Body>
      
      <urn:FindByDnsName>
         <urn:_this type="SearchIndex">SearchIndex</urn:_this>
         <!--Optional:-->
         <urn:dnsName>testupgrade</urn:dnsName>
         <urn:vmSearch>true</urn:vmSearch>
      </urn:FindByDnsName>
   </soapenv:Body>
</soapenv:Envelope>

soapui调用wsdl需要安全验证_soapui wsdl_soapui生成wsdl文件

View Code

注意上面xml中<urn:_this type="SearchIndex">SearchIndex</urn:_this>红色字体是按照文档中的定义填写的

然后添加headersoapui调用wsdl需要安全验证,作为认证信息,此处的cookie中填写的是,认证时response中的Set-Cookie ,具体如下图

技术分享

执行成功,Response的内容如下:

soapui wsdl_soapui调用wsdl需要安全验证_soapui生成wsdl文件

技术分享技术分享

<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <FindByDnsNameResponse xmlns="urn:vim25">
         <returnval type="VirtualMachine">vm-2823</returnval>
      </FindByDnsNameResponse>
   </soapenv:Body>
</soapenv:Envelope>

View Code

如果你设置的Header不对,那么系统将会报错:

faultstring:The session is not authenticated

参考:

soapUI: faultstring: The session is not authenticated

使用SoapUI调用Vsphere Web Service


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-140910-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      热点图片
      拼命载入中...