Jetty vs Weblogic Axis Response deserialization difference - jetty

I am testing my application with both Jetty(Eclipse) & Weblogic. I am calling an axis web service, receive a response and deserialize it. While everything works like a charm in Jetty, when I pack & deploy my application to weblogic I receive
org.xml.sax.SAXException: Invalid element in
com.xxx.yyyy.soa.schemas.INVOICE_ITEMType - CHARGE_TYPE
I am sure, both call the same Web service URL.
I decompiled the INVOICE_ITEMType class at war that I deploy to weblogic and made sure there is CHARGE_TYPE at INVOICE_ITEMType class.
What should I do to further investigate the case? I am stuck
Thank you

Finally realized that it is a classloader issue. My application unfortunately calls different web services from same third party company, whose interfaces re-uses same named-packeged objects with different implementations.

Related

Is a servlet inside a portlet required to make the portlet as a web service?

I have few questions with respect to portlets and servlets. This may be a continuation of
my previous question.
I m trying to create a portlet which should act also as a web service. I dont know Why,
but the client requires it this way. I negotiated with the client that I can make a
separate web service application using simple jersey servlet... but cannot convince.
I have the following doubts:
A portlet by itself cannot represent independently to the outside world. If that is
the case then what is the benefit in making a portlet as a webservice than not making a
complete webservice project with just servlets?
By web searches, I came across few code sample which can make a portlet as a
webservice. These sample codes suggested me to create a portlet, in the web.xml include the jersey-servlet and servlet container to make the portlet as a web service. Though it might work(I m trying hard to make a working codebase) but why to include a servlet container inside the portlet container which is already residing inside a servlet container. Sounds confusing? The following image can convey by doubt:
In this the liferay is a the servlet which is visible to the browser first. This has
multiple portlets in it. If I am making a portlet as a web service then I have to make it
visible to the browser, so I m including a servlet inside the portlet(Its my assumption
according to the sample code from web). This is like taking a round trip to touch my nose.
I really dont understand why this architecture is like that. The following points which I
guess is sensible for making a portlet as web service are:
(i) If I make a servlet(a separate project) for web service then (working as a liferay developer in the team) we cannot claim this as a liferay project.
(ii) If the web service is a portlet then I can have inter-portlet communication. In case of servlet it cannot(if I m not wrong).
Please suggest.
I think this can drive you to what you need. A portlet can be called in a EXCLUSIVE mode, where no portal or portlet content are generate in the response. So you can produce whatever "HTML" or data you need as a response.
Im researching and starting with Restful, but it seams like a request/response HTML communication. The main difference is the annotation that map an HTML to a Class and methods in standard modes. In liferay you can assign an URL to your portlet. It can produce a behaviour like the one in Restful.

jax-ws in Weblogic 10.3.5: IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions

We have a test web application deployed In Weblogic 10.3.5. The web application contains a servlet which uses jax-ws to call a web service deployed in the same weblogic.
Accessing the servlet throws the following exception:
Two classes have the same XML type name "address". Use #XmlType.name and #XmlType.namespace to assign different names to them.
this problem is related to the following location:
at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address
at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address com.sun.xml.ws.developer.MemberSubmissionEndpointReference.addr
at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
this problem is related to the following location:
at javax.xml.ws.wsaddressing.W3CEndpointReference$Address
at private javax.xml.ws.wsaddressing.W3CEndpointReference$Address javax.xml.ws.wsaddressing.W3CEndpointReference.address
at javax.xml.ws.wsaddressing.W3CEndpointReference
I copied the logic of the servlet into a common java class, and ran it. The test succeeded. So the problem should lie in the web application.
I have tried many ways, modify weblogic-application.xml to add prefer-application-packages section like below, but still doesn't work.
<prefer-application-packages>
<package-name>javax.xml.ws.*</package-name>
<package-name>javax.xml.bind.*</package-name>
<package-name>javax.jws.*</package-name>
<package-name>javax.namespace.xml.*</package-name>
<package-name>javax.xml.soap.*</package-name>
<package-name>org.apache.xerces.*</package-name>
<package-name>org.apache.commons.*</package-name>
<package-name>com.sun.xml.*</package-name>
</prefer-application-packages>
Anyone can help me on this, spent several days on this bug, no progress at all.
Thanks a million for your reply in advance.
Update 1
In the web application, we don't want to use metro, just use jax-ws downloaded from java.net, and put put jaxws-rt.jar, jaxws-api.jar, jaxb and other related jars in the ear/APP-INF/lib.
WebLogic Classloader Analysis Tool (wls-cat) tells there are some classes conflict, and suggests to add prefer-application-packages in weblogic-application.xml.
So We add prefer-application-packages to tell weblogic load them from from our application, not from weblogic jax-ws/metro implmentation.
But still doesn't work.
The problem might come from the fact that you want to use Metro JaxWs in Weblogic which has it's own implementation called Oracle JaxWS (based on Metro).
Here is a link where is explained how use Metro with Weblogic :
http://metro.java.net/guide/ch02.html#weblogic-10
If you don;t use Metro and rely on Oracle JaxWS you do not have to used preferred libs or any special packaging.

Unable to call a secure webservice after making a secure call over MQ

I am working on a j2ee project, which is a public website. The application has a lot of security built in.
It makes a call over MQs to a mainframe DB, i believe its a secure conversation. Everything works fine till this place.
My job is to make a call to a third party secure webservice, the url for the webservice is a https url.
When i make the first call from the application to the webservice, everything works well but if i place this call after the mainframe call, I get the following error.
the trust store located at "mynode" cannot be loaded. DerInputstream.getlength length tag=127 too big
Please pardon me, I cannot paste the code or config here, as its a client project.
The environment used is: IBM WAS 6.1 with webservices feature pack 6.0.15 & Spring Webservices 1.5.4
Any help would be appreciated. Thanks in advance
By default, there's only one keystore per JVM. Once you load the WMQ one, the web service will fail and vice versa. You can write code to manage multiple keystores as described in this post. In that case I suspect WMQ will need to use the JVM keystore while your app can select the alternate keystore through code.

Building web services without a web server

OK, this is impossible, but I will try to explain the situation here.
Let's say we have cases, that we need a fast setup of a web server in order to have a simple soap web service running (querying a db and so on).
In VS though, upon debugging a web project, it creates a quick ASP.NET development server without relying on the actuall IIS that might be installed on the PC.
Is there any project that does something like that?
This would be ideal for small projects, where a simple executable would get a server ready to go and would allow web services to be executed right away.
I have looked at some stuff over the net like http://msdn.microsoft.com/en-us/magazine/cc163879.aspx and http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2004/05/24/4479.aspx but they seem to be quite outdated and i am not sure how well they work (havent tested them thoroughly)
EDIT: I have build an application like the one you suggest. However, how can i implement HTTP GET/POST requests to the service using this method? I tried using WebGet after my operationcontract but it didnt work. For example, my service is at http://localhost:8080/Service and i would like to use it such as http://localhost:8080/Service/getMethod?x=2.
I believe that the development server used by Visual Studio is based off of the Cassini code base (of which there is a fork here). I also found this article on hosting the asp.net runtime. It was also created a while back (2004), but has been updated since (2008). I think a lot of the core concepts are probably still the same.
Another approach would be a roll-your-own web server using the HttpListener class. This could take some work if you want to use it for hosting asmx type services, but if you were doing RESTful services, it isn't too bad of an option (this is actually how RavenDB works if you are not hosting it under IIS).
A WCF service can be hosted in almost any kind of application, including a Windows Service or a console application. There is no need for a web server at all.
Alright,
i've done it so im posting it here to help anyone who has issues with similar problems.
Create your WCF Service file as usual and then by using ServiceHost (or WebServiceHost) you can easily create a WCF service.
In order to use GET http requests to make it simple to communicate with mobile devices (such as iphone) you can use WebGet above your service methods and make sure you manually add a service endpoint using WebHttpBinding for WebServiceHost or WebHttpBinding with an WebHttpBehavior for ServiceHost.
Then you can call your service methods such as http://localhost:port/webhttpendpointaddress/mymethod?x=2.

How to deploy an Axis-generated soap service to an embedded Tomcat instance

I generated a Soap Service from a WSDL and now I need to deploy it to my existing application which uses embedded tomcat (I.E. I have a class which extends TomcatServeletContainer and a main class which instantiates that class and starts the server).
I see many examples for how to deploy an axis service to a standalone tomcat using a WAR, or a WSDD, but I don't see how to wire it together myself. I assume I have to define a servelet in the web.xml and provide some other glue. Any assistance or pointers to appropriate documentation would be most appreciated.
Thanks!
-Carl
Have you been able to get this to work?
I've been trying to build a webservice (in a standalone war-file containing the axis jars (w/dependencies)+server-config.wsdd) using maven. I really don't want to make any calls to the AdminClient at all (meaning not to install Axis).
I've generated the server side sources from a WSDL using the axistools-maven-plugin, and everything seems to work ok until I have deployed the service. http://localhost:8080/myApp/services gives me the name of the service and two exposed methods. But clicking the wsdl link displays an Axis error message telling me "Could not generate WSDL! There is no SOAP service at this location".
Is it at all possible to build a standalone Axis webservice this way using maven?
Yes, you will need build your application the same way you would for a WAR but programmatically inform tomcat where you exploded war lives.
Everything else should be the same as the standard servlet spec.