Announcement Announcement Module
Collapse
No announcement yet.
Error Validating Response Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error Validating Response

    Hello

    i'm trying to solve this issue but currently can't

    this is the soap response i receive at SoapUI from the endpoint:

    Code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="soapenc">
       <soapenv:Body>
          <urn:GetRPCMethodsResponse xmlns:urn="urn:dslforum-org:cwmp-1-1">
             <MethodList soapenc:arrayType="xsd:string[5]">
                <string>Inform</string>
                <string>GetRPCMethods</string>
                <string>TransferComplete</string>
                <string>AutonomousTransferComplete</string>
                <string>RequestDownload</string>
             </MethodList>
          </urn:GetRPCMethodsResponse>
       </soapenv:Body>
    </soapenv:Envelope>
    see at the xmlns:soapenc, something is wrong because i think that the endpoint code is OK

    Code:
    package endpoints; 
    import org.jdom.Element;
    public class GetRPCMethods extends endpointBase{ 
    	
    	private int longArray = 0;
    	
    	private void incArray(){
    		longArray++;
    	}
    	
    	private String getArray(){
    		String respuesta="["+Integer.toString(longArray)+"]";
    		longArray=0;
    		return respuesta;
    	}
    	
    	private void agregarMetodo(String nombre, Element padre){
    		Element metodo = new Element("string");
    		metodo.setText(nombre);
    		padre.addContent(metodo);
    		incArray();
    	}
    
    	@Override 
    	protected Element invokeInternal(Element element) throws Exception { 
    
    		pruebaNS();
    		System.out.println("GetRPCMethods Recibido");
    		
    		Element rootElement = new Element("GetRPCMethodsResponse",urn);
    		Element listado = new Element("MethodList");
    
    		agregarMetodo("Inform",listado);
    		agregarMetodo("GetRPCMethods",listado);
    		agregarMetodo("TransferComplete",listado);
    		agregarMetodo("AutonomousTransferComplete",listado);
    		agregarMetodo("RequestDownload",listado);
    		
    		System.out.println(soapenc.getPrefix());
    		System.out.println(soapenc.getURI());
    		
    		listado.setAttribute("arrayType","string"+getArray(),soapenc);
    	        rootElement.addContent(listado);	
    		return rootElement;
    	} 
     
    }
    Code:
    package endpoints; 
     
    import java.io.IOException;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.Namespace;
    import org.jdom.output.XMLOutputter;
    import org.springframework.ws.server.endpoint.AbstractJDomPayloadEndpoint;
     
    public abstract class endpointBase extends AbstractJDomPayloadEndpoint{ 
        
    	protected final Namespace xsd = Namespace.getNamespace("xsd","http://www.w3.org/2001/XMLSchema");
    	protected final Namespace soapenv = Namespace.getNamespace("soapenv", "http://schemas.xmlsoap.org/soap/envelope/");
        protected final Namespace soapenc = Namespace.getNamespace("soapenc", "http://schemas.xmlsoap.org/soap/encoding/");
        protected final Namespace urn = Namespace.getNamespace("urn", "urn:dslforum-org:cwmp-1-1");
        
        protected void pruebaNS(){
        	System.out.println("--Test de NameSpaces--");
        	
        	System.out.println(xsd.toString());
        	System.out.println(soapenv.toString());
        	System.out.println(soapenc.toString());
        	System.out.println(urn.toString());
        }
    }
    and the log information ....

    Code:
    17:52:59,061 INFO  [STDOUT] GetRPCMethods Recibido
    17:52:59,077 INFO  [STDOUT] soapenc
    17:52:59,077 INFO  [STDOUT] http://schemas.xmlsoap.org/soap/encoding/
    17:52:59,201 ERROR [PayloadValidatingInterceptor] XML validation error on response: Undeclared namespace prefix "soapenc" (for attribute "arrayType")
     at [row,col {unknown-source}]: [1,141]
    In eclipse, when i "println" the soapenc namespace both prefix and uri are correctly filled but at the soapUI the soapenc URI has become "soapenc" string

    the soapenc namespace declaration is at the endpointBase.java and i've reviewed the endpoint code many times. i finally think that a JAR file is missing, i dont know
    Last edited by neotherack; Jul 7th, 2009, 11:57 AM.
Working...
X