doukeng1922 2013-09-12 08:03
浏览 38

简单的SOAP程序

I have to do a simple scritp (unix/linux target) to close log_file of a print spooler program

the spooler program give the chances to call the function over soap, but I know nothing of it

this is the function:

- <!--  VPSX System Close Account file Command request 
  --> 
- <message name="VPSX_SystemCloseAcct">
  <part name="SessID" type="xsd:string" /> 
  <part name="VPSID" type="xsd:string" /> 
  </message>


- <!--  VPSX System close account file Command request/response 
  --> 
- <operation name="VPSX_SystemCloseAcct">
  <input message="lrs:VPSX_SystemCloseAcct" /> 
  <output message="lrs:VPSX_SystemCmdResponse" /> 
  </operation>


<!--  VPSX System close account file Command request/response 
  --> 
- <operation name="VPSX_SystemCloseAcct">
  <soap:operation soapAction="" /> 
- <input>
  <soap:body use="encoded" namespace="http://www.lrs.com"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> 
  </input>
- <output>
  <soap:body use="encoded" namespace="http://www.lrs.com"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> 
  </output>
  </operation>

is there a simple way (python?php?java?) to do this?

I've tryed in perl

#!/usr/bin/perl

use SOAP::Lite;

my $WSDL= 'http://myserver:81/lrs/webconnect/vpsx?trid=vpsx';

my $soap = SOAP::Lite->on_fault(\&SoapFault)
                        ->service($WSDL);

my $logon = $soap->Logon
(
   SOAP::Data->type('string')->name('Server')->value("VSVK1"),
   SOAP::Data->type('string')->name('UserID')->value("serv"),
   SOAP::Data->type('string')->name('Password')->value("serv")
);

$sessionID = $logon->result();

#my $chiusura = $soap->VPSX_SystemCloseAcct
#(
#   SOAP::Data->type('string')->name('SessID')->value($sessionID),
#   SOAP::Data->type('string')->name('VPSID')->value("") 
#);

my $logoff = $soap->Logoff
( 
  SOAP::Data->type('string')->name('SessID')->value($sessionID)
);

but obtain this error

String value expected instead of SOAP::Data reference
  • 写回答

1条回答 默认 最新

  • dongshuobei1037 2013-09-15 11:50
    关注
    Try this URL
    http://www.soapui.org/Test-Automation/integrating-with-junit.html
    
    JUnit Integration
    
    It is fairly easy to invoke the testrunner from your own JUnit-tests;
    
    public void testRunner() throws Exception 
    {
      SoapUITestCaseRunner runner = new SoapUITestCaseRunner(); 
      runner.setProjectFile( "src/dist/sample-soapui-project.xml" );
      runner.run(); 
    }
    
    The runner.run() call will throw an exception if an error occurs. If you want more control over your integration / error-reporting, a specific TestCase could be run as follows:
    
    public void testTestCaseRunner() throws Exception 
    {
      WsdlProject project = new WsdlProject( "src/dist/sample-soapui-project.xml" ); 
      TestSuite testSuite = project.getTestSuiteByName( "Test Suite" ); 
      TestCase testCase = testSuite.getTestCaseByName( "Test Conversions" );
    
      // create empty properties and run synchronously
      TestRunner runner = testCase.run( new PropertiesMap(), false ); 
      assertEquals( Status.FINISHED, runner.getStatus() ); 
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行