please help, have problem markupbuilder groovy.
working soap request against endpoint myendpoint , action myaction:
<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>
trying replicate makrup builder closure within wslite soap-client object, not work (regarding namespacing issue think:
def bmclient = new soapclient('myendpoint') def response = bmclient.send(soapaction:'myaction') { header{ xsdinfo('xmlns':'urn:soap.bigmachines.com'){ schemalocation('schemalocation') } category('data tables') userinfo(){ sessionid('xxxxx') } } body{ add('xmlns':'urn:special'){ // problem here: should urn:table_name says urn not defined namespace.. datatables('table_name':'testtable'){ each_record(){ s1('something') } } } } } return response.addresponse.status.message.text() }catch(e){ println 'problem in addtodatatable session id: '+e.printstacktrace() } }
currently says:
wslite.soap.soapfaultexception: soapenv:init-err - element category, required in header.
although there category specified... stuck here, knows how create
<urn:datatables urn:table_name="testtable">
within markup closure properly?
i think problem, because have webservice running quity pretty on same logic, there no in it...
would great if that, working second day on it...
if want match structure exactly, should define urn
namespace on envelope using envelopeattributes
, , use on nested items so:
def response = bmclient.send(soapaction:'myaction') { envelopeattributes ('xmlns:urn' : 'urn:special') // watch out 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') } } } } }
Comments
Post a Comment