I have created a web service client project with the netbeans 6.9.1. The jar works like a charm when I run it directly from netbeans or from the console with java -jar. But when I put this jar into a webapplication as a library, It doesn't work. Actually, here is the weird thing about it, I have monitored the network traffic and saw that the responses on both sides are the same, but somehow when the jar is inside a webapp or working from an application server it doesn't manages to parse the response I think.
Long story in short,
The web service client code generated inside netbeans jaxws style(2.1) works by itself, But when it's called inside a web application within an application server , the response methods such as getsomething which resides in the response as sdfds doesn't work, but they work when runned separately. And the responses are exactly the same when I monitor the network traffics.
Can anyone help about this weird situation.
Thanks.
Edit: Also I discovered an exception:
com.sun.xml.internal.messaging.saaj.soap.impl.TextImpl cannot be cast to javax.xml.soap.SOAPElement
Which is not thrown anywhere in my local, bu only running at application servers. Tomcat or weblogic , both.
I encountered the exact sample problem in my SOAPHandler class. It turned out that the white space in the SOAP body is what cause this problem. Below are my SOAP request example from SOAPUI:
username
password
1
usa
75044
vn
usa
75034
SOAP request without white space in SOAP body:
username
password
1usa75044vnusa75034
Related
I am trying to develop my first web-application based on java-EE. This application should be deployed on WildFly application server. For That purpose, I made my inspiration from https://bitbucket.org/lassitercg/example/src.
I made some modifications on my Code.
I am developing this application using IntelliJ-Community. The Application was successfully deployed.
whenever I try to access the application using the following URL localhost:8080/startweb, I get the http status code 404. The code can be found unter this link https://github.com/amitakCsNew/startweb
Since I using Intellij Community edition, I am forced to deploy the application then set the breakpoint in the Controller of the application. The application seems to be succesfully deployed, but I am not jumping to the first breakpoint.
any Idea how I can solve this problem ?
Your webapp layout is wrong. Please refer to the standard Maven directories layout.
You need to move webapp directory to src/main. Then update pom.xml file reference to web.xml, then move META-INF from resources into webapp then fix your syntax errors in index.xhtml (the same h namespace is associated with 2 different URLs), then fix/implement your database, then add faces servlet in web.xml, add faces-config.xml, then your web app should be available at http://localhost:8080/startweb/.
Once you resolve all the problems and the controller code finally executes, you will be able to debug it from the IDE using Remote debug configuration.
If you are new to all of this, I'd suggest starting with something more simple, like a single JSP page and a single Java servlet.
Post the new questions if you have issues describing what you did to solve the problem and what exactly didn't work. The current question is too broad and your sample project has too many issues to cover in the single answer.
I got a SOAP web service with code first approach running with the built in JAX-WS implementation in Websphere 6.1.
The service was migrated from Websphere version 6.1 to version 8.5.
Formerly (version 6.1) the WSDL was available directly at the URL
[...]/services/SomeService?wsdl
Since migrating to version 8.5 the WSDL is still available via aforesaid URL, but a redirect is being made to
[...]/services/Services_002f_SomeService.wsdl
A client needs to access the WSDL before each request that is being made to the web service and is not getting on with the redirect (i.e. with the [...]?wsdl-URL), so he needs the redirected URL. (This is something I'm having no bearing on, unfortunately... )
Problem is that the '002f' part in the redirected URL is dynamic and might be changed by Websphere. (It did already in our testing environment.)
Does anybody know an option that prevents Websphere from the aforementioned redirect?
I finally found the reason for the weird '002f' characters in the redirect URL.
It is due to the given serviceName services/SomeService
#WebService (targetNamespace="http://example.net/", serviceName="services/SomeService")
\u002f is the '/' character in UTF8
So redirect goes to [...]/services/SomeService/Services_002fSomeService.wsdl and is reasonable.
The info of a possibly changing redirect URL to ...003f..., ...004f..., etc. which I got is obviously wrong.
Though not redirecting would not have caused any troubles at all and I don't know why the new JAX-WS implementation in WAS 8.5 really has to do that, I' coming to terms with just giving the (as I know know) static '002f' WSDL URL to the client.
We are integrating our software with another company using a webservice. They created a SOAP web service which we now need to test.
I'm trying to write a java program with Eclipse IDE. When creating a web service client, I enter the wsdl:
[https://xxxxxxxxx/xxxxxxx/index.php/gt/property/soap?wsdl]*
but I keep getting a message that states: The service definition is invalid.
Any ideas as to why this would be or any links I could check out would be appreciated. I have searched but haven't found anything that helped me yet.
Thanks!
If you are going for a Java program you could use,
Web service client given WSDL
But if you just want to test the web service, you could always use program like SoapUI
I'm having trouble wrapping my head around how to use servlets properly
I've set up a postgres database, and downloaded a JDBC driver for it.
What I want to have is my webpages post to the servlet, and the servlet get info from the database. I understand how to code everything (eg add library for driver, open connections, execute queries), but I think I'm lacking knowledge in how to set up the file structure.
I have the postgresql database running on pgAdmin. Do I also need to have a server running to make the servlets work as well? Can't I just make a web.xml file that maps to the servlets, and open the webpages to use the website? If I run the project through an IDE with a server running (glassfish) everything works. If I close the IDE and go to open the webpages on my browser again, I get 404's whenever I submit to a servlet.
Can someone give me a bit of guidance on the big picture of how everything is supposed to interact (with details on servers please). I've been searching the web and I havent found anything that explains the big picture very well.
Thanks
A Java web application is a set of files obeying a well-defined structure, and which can be packaged in a war file.
This web application is deployed into a server (also called container), which understands the file structure, listens to HTTP requests, and calls the appropriate servlet of the appropriate deployed web application when it receives one.
And of course, if you shut down the server, nothing listens to the HTTP requests anymore, so you won't get any response.
You could read the Java EE tutorial for more explanations.
Till now I have been coding in Java.
Wanted to know - what happens after deployment in Application Server
Suppose I deployed my EAR in AppServer (WebSphere or Jboss and Assuming Deployed Successfully!)
EAR convert into tmp files.. etc etc
How request picks some EAR or WAR in 100's of EARs or WARs in
Application Server ?
How application server look for datasources ?
How Plugin-cfg.xml works.
..
..
etc...etc..many more
Is there any document or anything ?
That is a VERY VERY vague question, I would start here: http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp
with the instructions for WebSphere Application server v7 "Developing and deploying applications" section.
I think the implementation of servers vary, so trying to put some basic principles.
How request picks some EAR or WAR in 100's of EARs or WARs in Application Server ?
Application Server keeps a list of WAR and bind URL patterns /* . If pattern matched, request goes to the application. Otherwise - error 404. Then application should be in memory, i.e. loaded by using specific classloader. After that methods like doGet called using reflection.
How application server look for datasources?
Application server collected all resources from xml description during startup and changes on request. Next, return it on call. Here is example from Tomcat source of taking datasource from Hashtable environment.