Forum Discussion

jwright's avatar
jwright
Occasional Contributor
16 years ago

responseHolder.declareNamespace

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def responseHolder = groovyUtils.getXmlHolder( "getContract#response" )

//This code works
log.info("first: " + responseHolder.getNodeValue("//p359:ContractIdNotFoundException/errorMessage"));
log.info("first: " + responseHolder.getNodeValue("//soapenv:Fault/faultstring"));

//This code does not work
responseHolder.declareNamespace( 'ns1', 'http://types.contract.svc.lhs.principal.com/ContractService_1_2/');
log.info(responseHolder.getNodeValue("//ns1:faultstring"));


I am trying to declare a namespace and the access the nodes.  This seems to not be working.  I have managed to access them by the full path as you can see above.  Below is the sml response that i am getting.


 

 
     
        p359:>ContractIdNotFoundException
        com.principal.lhs.svc.contract.types.ContractIdNotFoundException
       
           
              Contract Id Not Found
           

       

     

 


Any help on why my code may not be working would be helpful.  Thanks!!

1 Reply

  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    is not contained in and doesn't have any namespace declared, so it takes it's namespace from it's parent ().

    As long as you don't have other elements with a different namespace, you can just do

    log.info(responseHolder.getNodeValue("//faultstring"))


    without declaring a namespace.