dongtan7418
dongtan7418
2018-12-13 12:39
浏览 83

来自powershell的肥皂插入请求xml格式

i'm trying to make a soap service that is capable of inserting certain values into a microsoft sql database, the server is php and the client calls the server from powershell.

So i have a Soap server setup with NuSOAP and a number of methods, these methods are made like this: $server->register('InsertInDb', array('query' => 'xsd:string'), // parameter array('return' => 'xsd:string'), // output 'urn:server', // namespace 'urn:server#helloServer', // soapaction 'rpc', // style 'encoded', // use 'the query you want to execute');

now i can call this method with the following code from the powershell client:

$url = ".../NuSoapServerTest.php?wsdl"
$proxy = New-WebServiceProxy $url
$proxy | gm -memberType Method
$proxy.InsertInDb('Insert into value etc...')

however i want to be able to execute a method like this

    $url = ".../NuSoapServerTest.php?wsdl"
$soap = [xml]@'
 <?xml version="1.0" encoding="utf8"?>
 <soap:Envelope xmlns:xsi=".../NuSoapServerTest.php?wsdl">
 <soap:Body>
    <inventory>
        <machine>
            <systemname>example value</systemname>
        </machine>
        <hardware>
            <machine_type>example value</machine_type>
        </hardware>
    </inventory> 
 </soap:Body>
 </soap:Envelope>
'@
$ret = Execute-SOAPRequest $soap $url;

with each <'tag'> meaning a layer in the database. i've been looking around the web a lot for examples but as of yet i haven't found any examples that make it clear to me how i can set either the server or client up to execute my methods in the demonstrated way.

Maybe i am misunderstanding the principals of SOAP and how its supposed to work or i'm just being dumb but any help would be appreciated

edit: it might be worth noting this is the first time i am working with powershell.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

相关推荐