Samuel Jason

Greenhorn
+ Follow
since Jun 26, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Samuel Jason

Hello Friends,

I am using a spring-ws client to invoke a web service in two way ssl mode. I need to make sure that I don't end up creating a new connection everytime - instead I re-use connections.
I did some re-search and found that by default HTTP 1.1 always makes persistent http(s) connections. Is that true?

Do I need any piece of code in my client to ensure connections are persistent? How can I check if the connections are persistent or if a new connection is being created vereytime I send a new request ?

Below is my sping context xml:
12 years ago

Magnus Kul wrote:However, is it a way to make the program get the text files without having the physical files in the same folder as the jar file?



Could you post your findings , please?
12 years ago
HI,

I am working on a spring-ws client to invoke a webservice using binary security token. I have all the code set-up and everything seems to be working fine except for one issue.

This spring-ws client will be deployed as part of an EAR on weblogic server. There are several third part jar files in the classpath including axis jars.

Now following line is my code is causing troubles :

where ctxElement is of type JAXBElement and header is of type javax.xml.soap.SOAPHeader;

Error: addHeaderElement(javax.xml.soap.Name) in javax.xml.soap.SOAPHeader cannot be applied to (javax.xml.namespace.QName)

I did some analysis and figured out the issue - javax.xml.soap.SOAPHeader class is available in both axis/saaj.jar and spring/jaxb-api2.1jar.
The version present in axis/saaj.jar only has following method
javax.xml.soap.SOAPHeader.addHeaderElement(Name)

The version present in spring/jaxb-api2.1jar only has both the following methods
javax.xml.soap.SOAPHeader.addHeaderElement(Name)
javax.xml.soap.SOAPHeader.addHeaderElement(QName)

Now do I solve this issue -

Should I just make sure spring/jaxb-api2.1jar appears before axis/saaj.jar in the classpath. Is that the correct way to address this issue in a production environment.
What are the alternate solutions?

Please help

12 years ago
I am still not able to figure how to add binary security token to Soap Header using Rampart.
I am able to 'engage' rampart module but I am not sure what to mention in config file so that handler class will get invoked.

any one done this before ? I am using Axis2 with rampart.
12 years ago
Hi,

I'm generating code for a web service using axis2 with xmlbeans method.

In the first place, what stunned me was the number of files that are
generated for a web service client: approximately 1500 ! The first thing
comes to mind is why on earth would you need so many files?

I presume these generated xsb files are somehow dependent on the wsdl or
xsd, since they're generated each time I run wsdl2java.
Another quirk is the TypeSystemHolder class, that is generated, and placed
somewhere between the xsb files. It's not a generated source file that is
located with the other, regular source files. You need to have it on the
classpath; that's all I know.

I don't feel comfortable bundling so many files into my enterprise application for a single client. What about going forward if I were to create 20 more clients - 20 * 1500 files ???
Am I doing something wrong or is it just the way it( axis2 with xmlbeans) is.

Please help guys
12 years ago
Guys - Do we have a solution to this problem. I am facing similar issues.

Ulf Dittmer wrote:While you can do it programmatically, WS-Security is generally configured outside of the code in config files (WSDD files in the case of Axis2). You'll need the Axis2 Rampart module for this.

I've written a couple of articles about this that you may find useful: Web Services Authentication with Axis 2 and Web Services Security - Encryption



Thanks for the link.
One of the lines from your article reads as "WS-Security can perform 4 different actions: Timestamping, Authentication, Encryption and Signature".
I am requird to a binarysecuritytoken to the Soap Header. Is that possible using Rampart ? I believe PWHandlerClient will have logic to add create and add the binarysecuritytoken and conf/axis2.xml should have some action elements corresponding to addition of binarysecuritytoken ?

Sample Header:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:date="http://exslt.org/dates-and-times">
<SOAP-ENV:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3">MIIC/.........</wsse:BinarySecurityToken>
</wsse:Security>
</SOAP-ENV:Header>


12 years ago
Hello Friends,

I am building a Java client for a web service. The WSDL for the web service doesn't mention about ws security details but I am told to include it in my request to the web service.
I used AXIS2( WSDL2Java) to auto generate the client using the provided WSDL. Obviously, it did not generate any methods to add security details to Soap Header as the WSDL didn't have any security elements.

Now how do I make it work? DO I need to modify the auto generated client code to add custom methods to add security elements to Soap header?
What are the best practices for such scenarios?

Tech used:
Java 5
Axis2 ( 1.4)
12 years ago

William Brogden wrote:Well, I suppose it is possible, but what would be the advantage?


Could you point me to some sample code as to how I can write a generic client.

You would end up having to find some way to tell this generic client what to do with the received SOAP response. Given the huge variety of possible SOAP services that would get quite as complicated as writing custom code in Java. [/quote wrote:
This generic client code will simply pass back the soap response to the calling method. It will not process Soap response messages.

12 years ago
Hello Friends,

I am newbie to the world of webservices and have been learning through various tutorials online.
I understand that provided a WSDL, you can generate client stub using AXIS2 - say XML beans method. (It generates lots and lots of classes and I don't like that so many of them integrated into my application code)

My Question: Can we have a generic java client which could invoke any webservice ? Say we provide service details(like endpoint URL), Header elements, Body elements - as arguments to a method in the generic java client. All the client does is build soap message using the input parameters and invoke the webservice and pass back the response.

I am working on an application which is supposed to invoke several synchronous soap based webservices. I am trying to understand if I can build a common re-usable client for all the webservices instead of generating hundreds of java files for each of them using AXIS2- XMLBeans method.

Appreciate any ideas/suggestions around this?
12 years ago