2013-07-30 44 views
0

我正在使用SOAP :: Lite創建Web服務客戶端。第一個XML數據包是Java測試GUI發送的內容。它收到正確的答覆。創建SOAP :: Lite Perl Web Services客戶端時出現問題

第二個是我的Perl客戶端發送的XML數據包(根據SOAP :: Lite調試輸出)以及我從服務器接收到的響應是所有輸入的參數(hostnameFQ等)都是空的。

<?xml version="1.0" encoding="UTF-8"?> 
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> 
<S:Header/> 

<S:Body> 
    <ns2:postEvent xmlns:ns2="http://ws.health.server/"> 
     <hostnameFQ>a</hostnameFQ> 
     <eventLabel>b</eventLabel> 
     <deviceInst>c</deviceInst> 
     <severity>d</severity> 
     <message>e</message> 
     <eventSource>f</eventSource> 
    </ns2:postEvent> 
</S:Body> 
</S:Envelope> 

<?xml version="1.0" encoding="UTF-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 

<soap:Body> 
    <postEvent xmlns="http://ws.health.server/"> 
     <hostnameFQ>a</hostnameFQ> 
     <eventLabel>b</eventLabel> 
     <deviceInst>c</deviceInst> 
     <severity>d</severity> 
     <message>e</message> 
     <eventSource>f</eventSource> 
    </postEvent> 
</soap:Body> 
</soap:Envelope> 

他們對我來說看起來是一樣的...所以我不太清楚發生了什麼事情。

這裏是我的Perl代碼,如果這是有幫助的:

my $EVENT_LISTENER_PROXY = "http://localhost:8080/EventListener/EventListener"; 

my $soap = SOAP::Lite->new(proxy => $EVENT_LISTENER_PROXY); 
$soap->on_action(sub { "http://ws.health.server/#postEvent" }); 
$soap->autotype(0); 
$soap->default_ns('http://ws.health.server/'); 

my $som = $soap->call("postEvent", 
SOAP::Data->name('hostnameFQ')->value("a"), 
SOAP::Data->name('eventLabel')->value("b"), 
SOAP::Data->name('deviceInst')->value("c"), 
SOAP::Data->name('severity')->value("d"), 
SOAP::Data->name('message')->value("e"), 
SOAP::Data->name('eventSource')->value("f") 
); 

人有什麼想法?

回答

0

好的,出於某種原因,服務器不喜歡使用默認名稱空間值的XML輸入。我改變:

$soap->default_ns('http://ws.health.server/'); 

$soap->ns('http://ws.health.server/'); 

和它的工作。