Server did not recognize the value of HTTP Header SOAPAction

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • msg2ajay
    New Member
    • Jun 2007
    • 17

    Server did not recognize the value of HTTP Header SOAPAction

    hello friends,
    I wrote a WebService client as below

    Code:
    import org.apache.axis.client.Call; 
    import org.apache.axis.client.Service; 
     
    import javax.xml.namespace.QName; 
     
    public class AtmuClient 
    { 
            public static void main(String [] args) { 
                   try { 
                            String req="request"; 
                       String endpoint ="http://deleted/mims/service.asmx?WSDL"; 
                       String nameSpaceUri = "http://www.deleted.com/MIMS"; 
                        
                       Service  service = new Service(); 
                       Call     call    = (Call) service.createCall(); 
     
                       call.setTargetEndpointAddress( new java.net.URL(endpoint) ); 
                       call.setOperationName(new QName(nameSpaceUri, "echoString") ); 
     
                       String ret = (String) call.invoke( new Object[] { req } ); 
                       System.out.println("Sent 'Hello!', got '" + ret + "'"); 
     
                   } catch (Exception e) { 
                       System.err.println(e.toString()); 
                   } 
               } 
            
    }

    the out put I am getting is


    Server did not recognize the value of HTTP Header SOAPAction: .




    what still I need to incorporate to my code. Do i need to add any methods still ? and one more thing is do i need to write WSDD for this? how ?. can any bady guide me

    thanQ for any greatful guidance.
    Ajay.
    Last edited by RedSon; Jan 15 '08, 03:40 PM.
  • ezanih
    New Member
    • Feb 2008
    • 1

    #2
    Hi Ajay

    There appears to be a bug in Axis. Just add this 2 lines of code before you initialize call. Check out my code below. If you manage to fix yours, can you please test out my code and why it cannot access the Stock Quote web service (code below). I'm getting an exception. Thanks!

    Code:
    package mypackage;
    
    
    import org.apache.axis.client.Call;
    import org.apache.axis.client.Service;
    import javax.xml.namespace.QName;
    
    
    public class SOAPTest
    {
    
    	public static void main(String [] args) throws Exception {
           
    		try {
               
    				String endpoint =  "http://www.webserviceX.NET/stockquote.asmx";
    				//String endpoint =  "http://www.webserviceX.NET/stockquote.asmx?method=GetQuote";
    				//String endpoint =  "http://www.webserviceX.NET";
    	        
    	           
    	           Service  service = new Service();
    	           
    	           
    	           Call call= (Call) service.createCall();
    	           
    	
    	           call.setProperty( Call.SOAPACTION_USE_PROPERTY, new Boolean( true ) );
    	           call.setProperty( Call.SOAPACTION_URI_PROPERTY, "http://www.webserviceX.NET/GetQuote");
    	           
    	
    	           call.setTargetEndpointAddress( new java.net.URL(endpoint) );
    	           call.setOperationName(new QName("http://www.webserviceX.NET/GetQuote", "GetQuote") );
    	           
    	
    	           String ret = (String) call.invoke( new Object[] { "MSFT" } );
    	           System.out.println("Sent 'MSFT', got '" + ret + "'");
    
               
    		} catch (Exception e) {
    
    			
    			   System.err.println(e.toString());
    			   //e.printStackTrace();
           }
       }
    }

    Comment

    Working...