Web services groovy wslite markupbuilder解决了soap客户端中的名称空间问题

Web services groovy wslite markupbuilder解决了soap客户端中的名称空间问题,web-services,groovy,soap-client,markupbuilder,Web Services,Groovy,Soap Client,Markupbuilder,请帮助,我对groovy的markupbuilder有问题 针对端点MYENDPOINT和操作MYACTION的工作SOAP请求: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:SPECIAL"> <soapenv:Header> <urn:xsdInfo> <urn:schemaLo

请帮助,我对groovy的markupbuilder有问题

针对端点MYENDPOINT和操作MYACTION的工作SOAP请求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:SPECIAL">
   <soapenv:Header>
      <urn:xsdInfo>
         <urn:schemaLocation>SCHEMALOCATION</urn:schemaLocation>
      </urn:xsdInfo>
      <urn:category>Data Tables</urn:category>
      <urn:userInfo>
         <urn:sessionId>XXXXX</urn:sessionId>
      </urn:userInfo>
   </soapenv:Header>
   <soapenv:Body>
      <urn:add>
         <urn:DataTables urn:table_name="testtable">
            <!--Zero or more repetitions:-->
            <urn:each_record>
               <urn:s1>Somedinputdata</urn:s1>
            </urn:each_record>
         </urn:DataTables>
      </urn:add>
   </soapenv:Body>
</soapenv:Envelope>
目前它说:

wslite.soap.SOAPFaultException: soapenv:INIT-ERR - The element category, is required in the header.
虽然指定了一个类别。。。 我只是被困在这里,有人知道如何创造

<urn:DataTables urn:table_name="testtable">

在标记闭包中是否正确

我认为这就是问题所在,因为我有另一个Web服务运行在相同的逻辑上,但其中没有


如果有人能帮上忙那就太好了,我第二天就开始工作了…

如果你想精确匹配结构,你应该使用
信封属性定义信封上的
urn
名称空间,并在嵌套项上使用它,如下所示:

def response = bmClient.send(SOAPAction:'MYACTION') {
    envelopeAttributes ('xmlns:urn' : 'urn:SPECIAL')   // watch out for brackets here!
    header{
          'urn:xsdInfo'{
              'urn:schemaLocation'('SCHEMALOCATION')
          }  
          'urn:category'('Data Tables')
          'urn:userInfo' {
              'urn:sessionId'('XXXXX')
          }
    }
    body{
          'urn:add' {
             'urn:DataTables'('urn:table_name':'testtable'){
                'urn:each_record'{
                   'urn:s1'('something')            
                }
             }
        }
    }
}

您的解决方案非常有效。非常感谢你!!!
def response = bmClient.send(SOAPAction:'MYACTION') {
    envelopeAttributes ('xmlns:urn' : 'urn:SPECIAL')   // watch out for brackets here!
    header{
          'urn:xsdInfo'{
              'urn:schemaLocation'('SCHEMALOCATION')
          }  
          'urn:category'('Data Tables')
          'urn:userInfo' {
              'urn:sessionId'('XXXXX')
          }
    }
    body{
          'urn:add' {
             'urn:DataTables'('urn:table_name':'testtable'){
                'urn:each_record'{
                   'urn:s1'('something')            
                }
             }
        }
    }
}