Re: J2ME Client and .NET Web Service

Stefan Haustein <[email protected]> Mon, 17 Nov 2003 16:08:09 +0100
Newsgroups gmane.comp.java.enhydra.ksoap
Message-ID <[email protected]>
Hi,

it's difficult to see what's going on without a wire protocol. Can you send a 
request/responseDump for the call?

Best,
Stefan


srinivasan paramasivam wrote:
> Hi,
> 
>     I am trying to build a J2ME/MIDP client for a
> simple .NET Web Services. Where i'm trying to pass an
> argument to .Net web Service and I'm trying to get a
> reply as Hello "World". 
>   
>     But everytime i'm geting Hello only. could kindly
> help me, since i'm getting struck and i can't able to
> proceed further. 
>  
>  
> Thanks 
> Srinivasan. P
>  
> Here is the definition for the web mehod and the
> MIDlet code:
> 
> 
> import javax.microedition.midlet.*;
> import javax.microedition.lcdui.*;
> import org.ksoap.*;
> import org.ksoap.transport.*;
> import org.kxml.*;
>  
> 
> public class SOAPRequestResponse extends MIDlet
> implements CommandListener {
>     
>     private Command exitCommand; 
>     private Display display;    
> 
>    public SOAPRequestResponse() {
> 
>         display = Display.getDisplay(this);
>         exitCommand = new Command("Exit",
> Command.SCREEN, 2);
>     }    
>     
> 	
> public void startApp() 
> {		
> Object cSR; 
> cSR = getService("HelloWorld");
> SoapObject objResult = (SoapObject) cSR; //service
> TextBox t = new TextBox("Hello MIDlet","test", 256,
> 0);        		
>        t.addCommand(exitCommand);		
>        t.setCommandListener(this);        
>         display.setCurrent(t);		
> 
> 
>  } // end of startApp()
> 
> 
> 
>     
>     
>     public void pauseApp() {
>     }
>     
>     
>     public void destroyApp(boolean unconditional) {
>     }
>     
>     
>     public void commandAction(Command c, Displayable
> s) {
>         if (c == exitCommand) {
>             destroyApp(false);
>             notifyDestroyed();
>         }
>     }
>     
> 
> private Object getService(String methodName)
>  {
> 		
> Object obj = null;
> ClassMap classMap = null;
> Object presult = null;
> String presult = null;
> 
> try
>  {			
>     HttpTransport transport = new
> HttpTransport("http://gautham/TrackerTest/Service1.asmx",
> "HelloWorld");			
> transport.debug = true;			
> transport.setSoapAction("http://tempuri.org/TrackerTest/Service1/HelloWorld");
> 				
> 			
> classMap = new ClassMap();			
> classMap.prefixMap = new
> PrefixMap(classMap.prefixMap,"sri",serviceNameSpace);	
> 	
> transport.setClassMap(classMap);
> 
> 			
> SoapObject requestMessage = new
> SoapObject("http://tempuri.org/TrackerTest/Service1/HelloWorld","HelloWorld"
> 		
> requestMessage.addProperty("name","Kamal");
> 		
> 			
> presult = transport.call(requestMessage);
> 
> 
>             
>         }
>         catch(Exception ex )
>         {
> 			System.out.println("... itz throwing exception..."
> +  ex);	
>             System.out.println("Request \n" +
> transport.requestDump);
> 			System.out.println("Response \n" +
> transport.responseDump);
> 	        }   
> 		return presult;
> 	} // end of getService
> }
> 
> 
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Protect your identity with Yahoo! Mail AddressGuard
> http://antispam.yahoo.com/whatsnewfree
> _______________________________________________
> Ksoap mailing list
> [email protected]
> http://www.enhydra.org/mailman/listinfo.cgi/ksoap