Solved

Applet And .NET web Service Calling

Posted on 2011-02-22
15
1,299 Views
Last Modified: 2012-06-27
Dear Support,

I have made an applet to call .NET Web Service as following url:
http://10.16.9.84/PalmIdenticWS/PalmIdenticWSClient.asmx

The applet runs fine when the web service and the applet reside in the same machine (i.e. open the jsp page inside the web server that contains also the web service)

But when I tried the same to open the JSP page that's contain the applet, it gives me an error) please, see the error code below from the console of the applet
security: property package.access value sun.
security: property package.access new value sun.,com.sun.javaws
security: property package.access value sun.,com.sun.javaws
security: property package.access new value sun.,com.sun.javaws,com.sun.deploy
security: property package.access value sun.,com.sun.javaws,com.sun.deploy
security: property package.access new value sun.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition value null
security: property package.definition new value com.sun.javaws
security: property package.definition value com.sun.javaws
security: property package.definition new value com.sun.javaws,com.sun.deploy
security: property package.definition value com.sun.javaws,com.sun.deploy
security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access value sun.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access new value sun.,com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
security: property package.definition value com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
basic: setDeployURLClassPathCallbacks: no enhanced access
basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@5e3974
network: Cache entry not found [url: http://10.16.10.61:8080/PalmIdenticClient/palmIdenticSigned.jar, version: null]
network: Connecting http://10.16.10.61:8080/PalmIdenticClient/palmIdenticSigned.jar with proxy=HTTP @ jd-proxy/10.16.4.24:8080
network: Connecting http://10.16.10.61:8080/PalmIdenticClient/palmIdenticSigned.jar with cookie "JSESSIONID=1DD967AF2B36A4ECB6E3C0E2BEE25A91"
network: Cache entry not found [url: http://10.16.10.61:8080/PalmIdenticClient/palmIdenticSigned.jar, version: null]
network: Connecting http://10.16.10.61:8080/PalmIdenticClient/palmIdenticSigned.jar with proxy=HTTP @ jd-proxy/10.16.4.24:8080
java.io.IOException: Server returned HTTP response code: 502 for URL: http://10.16.10.61:8080/PalmIdenticClient/palmIdenticSigned.jar
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
        at sun.plugin.PluginURLJarFileCallBack.downloadJAR(Unknown Source)
        at sun.plugin.PluginURLJarFileCallBack.access$000(Unknown Source)
        at sun.plugin.PluginURLJarFileCallBack$2.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.plugin.PluginURLJarFileCallBack.retrieve(Unknown Source)
        at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)
        at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
        at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
        at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
        at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(Unknown Source)
        at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFileInternal(Unknown Source)
        at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(Unknown Source)
        at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(Unknown Source)
        at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$800(Unknown Source)
        at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(Unknown Source)
        at com.sun.deploy.security.DeployURLClassPath$JarLoader.<init>(Unknown Source)
        at com.sun.deploy.security.DeployURLClassPath$3.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
        at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
        at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
        at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
        at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
        at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
        at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
        at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
        at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
        at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
network: Cache entry not found [url: http://10.16.10.61:8080/PalmIdenticClient/palmIdenticSigned.jar, version: null]
network: Connecting http://10.16.10.61:8080/PalmIdenticClient/palmIdenticSigned.jar with proxy=HTTP @ jd-proxy/10.16.4.24:8080
network: Connecting http://10.16.10.61:8080/PalmIdenticClient/palmIdenticSigned.jar with cookie "JSESSIONID=1DD967AF2B36A4ECB6E3C0E2BEE25A91"
network: Cache entry not found [url: http://10.16.10.61:8080/PalmIdenticClient/com/NIT/palmidentic/applet/PvsApplet.class, version: null]
network: Connecting http://10.16.10.61:8080/PalmIdenticClient/com/NIT/palmidentic/applet/PvsApplet.class with proxy=HTTP @ jd-proxy/10.16.4.24:8080
network: Connecting http://10.16.10.61:8080/PalmIdenticClient/com/NIT/palmidentic/applet/PvsApplet.class with cookie "JSESSIONID=1DD967AF2B36A4ECB6E3C0E2BEE25A91"
network: Cache entry not found [url: http://10.16.10.61:8080/PalmIdenticClient/com/NIT/palmidentic/applet/PvsApplet/class.class, version: null]
network: Connecting http://10.16.10.61:8080/PalmIdenticClient/com/NIT/palmidentic/applet/PvsApplet/class.class with proxy=HTTP @ jd-proxy/10.16.4.24:8080
network: Connecting http://10.16.10.61:8080/PalmIdenticClient/com/NIT/palmidentic/applet/PvsApplet/class.class with cookie "JSESSIONID=1DD967AF2B36A4ECB6E3C0E2BEE25A91"
basic: load: class com.NIT.palmidentic.applet.PvsApplet.class not found.
load: class com.NIT.palmidentic.applet.PvsApplet.class not found.
java.lang.ClassNotFoundException: com.NIT.palmidentic.applet.PvsApplet.class
        at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
        at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
        at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
        at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
        at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
        at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed:http://10.16.10.61:8080/PalmIdenticClient/com/NIT/palmidentic/applet/PvsApplet/class.class
        at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
        at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
        at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        ... 9 more
Exception: java.lang.ClassNotFoundException: com.NIT.palmidentic.applet.PvsApplet.class

Open in new window

0
Comment
Question by:Bassam_Basamad
  • 8
  • 6
15 Comments
 
LVL 92

Expert Comment

by:objects
ID: 34949558
your getting a 502 from your proxy when browser try to load http://10.16.10.61:8080/PalmIdenticClient/palmIdenticSigned.jar
0
 

Author Comment

by:Bassam_Basamad
ID: 34949579
Sorry, I have post wrong error code, Can you look the below error from console
Java Plug-in 1.6.0_22
Using JRE version 1.6.0_22-b04 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Administrator

----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------

security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition value null
security: property package.definition new value com.sun.javaws
security: property package.definition value com.sun.javaws
security: property package.definition new value com.sun.javaws,com.sun.deploy
security: property package.definition value com.sun.javaws,com.sun.deploy
security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
security: property package.definition value com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@80f4cb
basic: Plugin2ClassLoader.addURL parent called for http://10.16.9.84:8080/PalmIdenticClient/palmIdenticSigned.jar
security: Blacklist revocation check is enabled
security: Trusted libraries list check is enabled
network: Cache entry found [url: http://10.16.9.84:8080/PalmIdenticClient/palmIdenticSigned.jar, version: null] prevalidated=false/0
network: Connecting http://10.16.9.84:8080/PalmIdenticClient/palmIdenticSigned.jar with proxy=HTTP @ jd-proxy/10.16.4.24:8080
network: Connecting http://10.16.9.84:8080/PalmIdenticClient/palmIdenticSigned.jar with cookie "JSESSIONID=6BEDB58058C210C5F244E0C417CBB53A"
network: ResponseCode for http://10.16.9.84:8080/PalmIdenticClient/palmIdenticSigned.jar : 304
network: Encoding for http://10.16.9.84:8080/PalmIdenticClient/palmIdenticSigned.jar : null
network: Disconnect connection to http://10.16.9.84:8080/PalmIdenticClient/palmIdenticSigned.jar
cache: Reading Signers from 1842 http://10.16.9.84:8080/PalmIdenticClient/palmIdenticSigned.jar | C:\Documents and Settings\Administrator\Application Data\Sun\Java\Deployment\cache\6.0\26\48484bda-6283f9af.idx
cache:  Read manifest for http://10.16.9.84:8080/PalmIdenticClient/palmIdenticSigned.jar: read=89 full=1982
security: Loading Root CA certificates from C:\Program Files\Java\jre6\lib\security\cacerts
security: Loaded Root CA certificates from C:\Program Files\Java\jre6\lib\security\cacerts
security: Loading Deployment certificates from C:\Documents and Settings\Administrator\Application Data\Sun\Java\Deployment\security\trusted.certs
security: Loaded Deployment certificates from C:\Documents and Settings\Administrator\Application Data\Sun\Java\Deployment\security\trusted.certs
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Loading certificates from Internet Explorer ROOT certificate store
security: Loaded certificates from Internet Explorer ROOT certificate store
security: Loading certificates from Internet Explorer TrustedPublisher certificate store
security: Loaded certificates from Internet Explorer TrustedPublisher certificate store
security: Validate the certificate chain using CertPath API
security: Obtain certificate collection in Root CA certificate store
security: Obtain certificate collection in Root CA certificate store
security: Start to check whether root CA is replaced
security: The root CA hasnt been replaced
security: No timestamping info available
security: Found jurisdiction list file
security: No need to checking trusted extension for this certificate
security: The CRL support is disabled
security: The OCSP support is disabled
security: This OCSP End Entity validation is disabled
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment permanent certificate store
security: Checking if certificate is in Deployment session certificate store
security: Checking if certificate is in Internet Explorer TrustedPublisher certificate store
security: User has granted the priviledges to the code for this session only
security: Adding certificate in Deployment session certificate store
security: Added certificate in Deployment session certificate store
security: Saving certificates in Deployment session certificate store
security: Saved certificates in Deployment session certificate store
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Loading certificates from Internet Explorer TrustedPublisher certificate store
security: Loaded certificates from Internet Explorer TrustedPublisher certificate store
security: Validate the certificate chain using CertPath API
security: Obtain certificate collection in Root CA certificate store
security: Obtain certificate collection in Root CA certificate store
security: Start to check whether root CA is replaced
security: The root CA hasnt been replaced
security: No timestamping info available
security: Found jurisdiction list file
security: No need to checking trusted extension for this certificate
security: The CRL support is disabled
security: The OCSP support is disabled
security: This OCSP End Entity validation is disabled
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment permanent certificate store
security: Checking if certificate is in Deployment session certificate store
basic: Plugin2ClassLoader.getPermissions CeilingPolicy allPerms
basic: Applet loaded.
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 185478 us, pluginInit dt 3522848 us, TotalTime: 3708326 us
basic: Applet initialized
basic: Removed progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@80f4cb
basic: Applet made visible
basic: Starting applet
basic: completed perf rollup
 Calling Ip 10.16.193.61
 Calling Host Name 10.16.193.61
 Referer http://10.16.9.84/palmex/
 dbId 3
 bioId azwarifm
 sex M
 Lang en
 userId FahadR
 PALMFUNCTION Verify
 ENABLESOUND 0
 WEB_SERVICE_URL http://10.16.9.84/palmidentic/PalmIdenticWebService.asmx
Loaded image: http://10.16.9.84:8080/PalmIdenticClient/Logo.bmp
network: Cache entry not found [url: http://10.16.9.84:8080/PalmIdenticClient/, version: null]
network: Cache entry not found [url: http://10.16.9.84:8080/PalmIdenticClient/Language.class, version: null]
network: Connecting http://10.16.9.84:8080/PalmIdenticClient/Language.class with proxy=HTTP @ jd-proxy/10.16.4.24:8080
network: Connecting http://10.16.9.84:8080/PalmIdenticClient/Language.class with cookie "JSESSIONID=6BEDB58058C210C5F244E0C417CBB53A"
network: Cache entry not found [url: http://10.16.9.84:8080/PalmIdenticClient/Language_en.class, version: null]
network: Connecting http://10.16.9.84:8080/PalmIdenticClient/Language_en.class with proxy=HTTP @ jd-proxy/10.16.4.24:8080
network: Connecting http://10.16.9.84:8080/PalmIdenticClient/Language_en.class with cookie "JSESSIONID=6BEDB58058C210C5F244E0C417CBB53A"
network: Cache entry not found [url: http://10.16.9.84:8080/PalmIdenticClient/Language_en.properties, version: null]
network: Connecting http://10.16.9.84:8080/PalmIdenticClient/Language_en.properties with proxy=HTTP @ jd-proxy/10.16.4.24:8080
network: Connecting http://10.16.9.84:8080/PalmIdenticClient/Language_en.properties with cookie "JSESSIONID=6BEDB58058C210C5F244E0C417CBB53A"
network: Cache entry not found [url: http://10.16.9.84:8080/PalmIdenticClient/Language_en_US.class, version: null]
network: Connecting http://10.16.9.84:8080/PalmIdenticClient/Language_en_US.class with proxy=HTTP @ jd-proxy/10.16.4.24:8080
network: Connecting http://10.16.9.84:8080/PalmIdenticClient/Language_en_US.class with cookie "JSESSIONID=6BEDB58058C210C5F244E0C417CBB53A"
network: Cache entry not found [url: http://10.16.9.84:8080/PalmIdenticClient/Language_en_US.properties, version: null]
network: Connecting http://10.16.9.84:8080/PalmIdenticClient/Language_en_US.properties with proxy=HTTP @ jd-proxy/10.16.4.24:8080
network: Connecting http://10.16.9.84:8080/PalmIdenticClient/Language_en_US.properties with cookie "JSESSIONID=6BEDB58058C210C5F244E0C417CBB53A"
network: Connecting http://10.16.9.84/palmidentic/PalmIdenticWebService.asmx/GetPalmSettings with proxy=HTTP @ jd-proxy/10.16.4.24:8080
java.io.IOException: Server returned HTTP response code: 500 for URL: http://10.16.9.84/palmidentic/PalmIdenticWebService.asmx/GetPalmSettings
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at com.nafithah.palmidentic.applet.jdbc.PvsDataManagerWebService.callWebService(PvsDataManagerWebService.java:411)
	at com.nafithah.palmidentic.applet.jdbc.PvsDataManagerWebService.getSettings(PvsDataManagerWebService.java:375)
	at com.nafithah.palmidentic.applet.PvsMainFrame.initialize(PvsMainFrame.java:1006)
	at com.nafithah.palmidentic.applet.PvsApplet.start(PvsApplet.java:44)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
 Setting is null
 Setting is null ,disbaling buttons 
Exception in thread "thread applet-com.nafithah.palmidentic.applet.PvsApplet.class-1" java.lang.UnsatisfiedLinkError: no PvsApiJv in java.library.path
	at java.lang.ClassLoader.loadLibrary(Unknown Source)
	at java.lang.Runtime.loadLibrary0(Unknown Source)
	at java.lang.System.loadLibrary(Unknown Source)
	at palmsecuresdk.sample.PvsAuthenticationJNI.<init>(PvsAuthenticationJNI.java:57)
	at palmsecuresdk.sample.PvsAuthenticationJNI.<clinit>(PvsAuthenticationJNI.java:48)
	at com.nafithah.palmidentic.applet.PvsMainFrame.initLibrary(PvsMainFrame.java:1401)
	at com.nafithah.palmidentic.applet.PvsMainFrame.initialize(PvsMainFrame.java:1056)
	at com.nafithah.palmidentic.applet.PvsApplet.start(PvsApplet.java:44)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Open in new window

0
 
LVL 92

Expert Comment

by:objects
ID: 34949651
its failing to load a shared/native library PvsApiJv
0
 

Author Comment

by:Bassam_Basamad
ID: 34949861
What about the line that appear like below for calling the web service:
Server returned HTTP response code: 500 for URL: http://10.16.9.84/palmidentic/PalmIdenticWebService.asmx/GetPalmSettings

And how to rectify this loading of the library (Palm Identification).?

thanks
0
 
LVL 92

Expert Comment

by:objects
ID: 34950250
not sure, check on your server as to why its failing
0
 

Author Comment

by:Bassam_Basamad
ID: 34950465
Do you provide remote support?
0
 
LVL 47

Expert Comment

by:for_yan
ID: 34952431
But you had everywhere in this log - port 8080 and your web service is requested without the port.
Does it mean that web service should be running on the default port 80?
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:Bassam_Basamad
ID: 34958127
Web services is running on IIS that's why is on the default port 80, and the port 8080 for the tomcat for running the JSP page that invoke the applet. The problem, is when I replace the localhost with the IP Address , it give me this error, although the IP Address of the local machine and also running in the same machine but it didn't work, for example if write in the Browser : http://localhost:8080/PalmIdentict....etc, it works fine, but if I change the localhost to the IP Address of the PC (i.e. 10.16.9.84:8080/PalmIdentic..etc) it does not work.

Can you figure what's that problem??
0
 
LVL 92

Expert Comment

by:objects
ID: 34958263
if you try and load http://10.16.9.84/palmidentic/PalmIdenticWebService.asmx/GetPalmSettings from browser what do you get
If you get a 500, check the server logs as to why
0
 

Author Comment

by:Bassam_Basamad
ID: 34958301
The below image will appear after you execute on the Browser the url either it is localhost or an IP Address.
 This image if I execute the url as it is (ether I put localhost or the IP Address)The below image will appear if do invoke from the following page http://localhost/palmidenticWS/PalmIdenticWebService.asmx?op=GetPalmSettings, means ("GetPalmSettings") is a method in the .NET web service, and you want to test it you just pass the parameter of the method and click on the button invoke(i.e. [To test the operation using the HTTP POST protocol, click the 'Invoke' button. ]) it will appear the below image, which is the output xml and if you read the url it will be like the above url.,
 After invoke the web service method
Kind Regards
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 34958339
Looks like the applet is making the wrong request

whats the console log look like when it loads ok?
0
 

Author Comment

by:Bassam_Basamad
ID: 34958701
I think I have found the problem in calling the web service, please see the below code
private String callWebService(String data, String webServiceName) {
            /*
            String webServiceUrl=PropertiesLoader.getProperty(PalmConstants.WEB_SERVICE_URL);
            */
            String webServiceUrl=ParametersStorage.WEB_SERVICE_URL;
            String answer=null;
            URL url;
            try {
                  url = new URL(webServiceUrl+"/"+webServiceName);
                  HttpURLConnection conn=(HttpURLConnection)url.openConnection();
                  conn.setDoOutput(true);
            conn.setRequestMethod("POST");            
                  conn.setRequestProperty( "Content-Type", "application/x-www-form-urlencoded" );                
                  OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream());              
              writer.write(data);
              writer.flush();
                  
                 
                  StringBuffer answerBf = new StringBuffer();
                 
                  BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                  String line;
                  while ((line = reader.readLine()) != null) {
                        answerBf.append(line);
                  }
                   reader.close();            
                 answer=answerBf.toString();    
                 writer.close();
            
            } catch (Exception e) {
                  e.printStackTrace();
            }
            return answer;
      }

_______________________________________

Open in new window


thank you
0
 

Author Comment

by:Bassam_Basamad
ID: 34958869
I am working on modify the application for calling web service as the following url
http://www.codeproject.com/KB/XML/WSfromJava.aspx

Please, if you have any feedback on calling web service please help me.

Thank you
0
 
LVL 92

Expert Comment

by:objects
ID: 34958926
0
 

Author Closing Comment

by:Bassam_Basamad
ID: 34994561
Thank you, I have solved the problem, by changing the way of calling the web service as the url in code project.

And It's works fine.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
what is the difference between "sudo su" and "su - root" 6 102
backtracking recursion  code 19 53
maven project error 5 47
Java Timer (static) 9 36
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now