2012-11-12 61 views
1

我创建了一个简单的头类:正确的XML为缓存Web服务的SOAP头发送

Class Sample.Headers Extends %SOAP.Header 
{ 
    Parameter NAMESPACE = "http://tempuri.org"; 
    Property UserName As %String; 
} 

在我提出一定要设置正确的命名空间中SOAPHEADERS参数的Web服务:

Parameter SOAPHEADERS = "UserName:Sample.Headers"; 

我送使用了SoapUI以下XML:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org"> 
    <soapenv:Header> 
     <tem:UserName>This is the header</tem:UserName> 
    </soapenv:Header> 
    <soapenv:Body> 
     <tem:Test> 
     <!--Optional:--> 
     <tem:argAge>10</tem:argAge> 
     </tem:Test> 
    </soapenv:Body> 
</soapenv:Envelope> 

我得到以下错误:

ERROR #6254: Tag expected, XML input, This is the header, is not in proper format as child of UserName (ending at line 3 character 18).

什么是正确的XML格式,以便UserName设置正确?

回答

1

只是需要改变:

Property UserName As %String; 

Property UserName As %String(XMLPROJECTION = "CONTENT", MAXLEN = 50); 
0

在例如采取偷看在这里:http://www.w3schools.com/soap/soap_header.asp

Note: All immediate child elements of the Header element must be namespace-qualified.

这似乎是XML的格式在本例有点不同,嵌套命名空间的Header属性的属性“跨”(在他们的例子中)。这可能是一个延伸,但我确实看到你的请求没有像这样明确地设置名称空间。

+0

我想他们的榜样与命名空间,我仍然得到同样的结果。 –