Jolly Tiwari

Ranch Hand
+ Follow
since Mar 26, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Jolly Tiwari

Hello everyone,

I am seeking your advice regarding development of single sign on solution.
The existing scenario is as follows.
We have 5 different WEB APPLICATIONS running on production server which have their respective login forms and underlying authentication and authorization logic.Now we have to come up with a single sign on solution for these underlying web applications.
I don't know exactly how i should proceed.I mean which API's i should look for and what would be the design for it.
I have googled a lot and tried my hands on JAAS also (just got a feel by developing a simple command prompt based trial app) but not able to find a clear cut working path.

please give your inputs

Regards

Jolly




13 years ago
Hi! Ivan,


I tried your soap_input.xml file also ,everything is running fine but this snippet from my last post

System.out.println(hdr);
System.out.println(bod);



gives

[SOAP-ENV:Header: null]
[SOAP-ENV:Body: null]




Unable to figure out why??

Regards

Jolly
Hi! Ivan,

Following your notes i am able to do basic authetication and also SSL encryption.But when i was trying for Mutual Authentication i am getting following stack trace:




To just make things clear i would like to add that i have added following to the sun-web.xml file

<security-role-mapping>
<role-name>user</role-name>
<principal-name>CN=RajeshT, OU=CRIS, O=IR, L=DLI,ST=DLI, C=IN</principal-name>
</security-role-mapping>



these entries for principal-name i have given from my client keystore

Can you please guide me what i should do to fix it and please elaborate it as i am just a novice to all this security aspect.

Thanks in Advance



Regards

Jolly
Hi! Ivan,

As told by you i am able to invoke a web service through a SAAJ client without requiring any client artifacts

Now i have a query regarding a scenario which i am facing , I am making a SOAP message using an external file.
but it is showing strange behaviour.



The first msg.writeTo(System.out) is displaying the correct result

%%%%%%%%%%Creating a soap message from an external file%%%%%%%%
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body><ns:multiply xmlns:ns="http://saaj.com/"><arg0>80</arg0><arg1>10<
/arg1></ns:multiply></SOAP-ENV:Body></SOAP-ENV:Envelope>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



but the last two System.out.println() are displaying



can you please clarify?

Thanks in Advance

Regards

Jolly
Thanks to both of you for your nice explaination


Regards

Jolly
Hi!

This is with refernce to 4.9 JAX-WS Web Service Client from IVan's guide

As per to the notes ,for Dynamic clients we need not generate any artifacts.But in that case how will these references in the below shown part of client code be resolved at the time of client code compilation.This is a part of that dynamic client code page No -172



please clarify...


Regards

Jolly
Hi! Ivan,

Thanks for the explaination.

sorry for missing the referece point,It is

Sec 4.8 JAX-WS Client Communication model,Page 162
Well I have few doubts about this

Lets say you want to write a web service testing program, like soapUI. Then you cannot use the proxy mechanism because you do not know which web services you will need to send requests to, at the time of writing your program.



private Dispatch<Object> prepareCalculatorDispatch()
throws MalformedURLException, JAXBException
{
QName theName =new QName(SERVICE_NAMESPACE, SERVICE_PORT_NAME);
URL theWsdlUrl = new URL(WSDL_LOCATION);
QName theServiceName = new QName(SERVICE_NAMESPACE, SERVICE_NAME);
Service theService = Service.create(theWsdlUrl, theServiceName);
JAXBContext theJaxbContext =JAXBContext.newInstance("com.ivan.calculator");
Dispatch<Object> theDispatch =theService.createDispatch(theName, theJaxbContext,Service.Mode.PAYLOAD);

return theDispatch;
}



Fine if we take this scenario (When we don't know about the WSDL at the time of client Programming) then in order to get a Dispatch Object from Service Object we require at least below mentioned information from the user at the time of Web service client execution.These can be taken from some designed user interface and passed on to the client to web service as Strings.
a)SERVICE_NAMESPACE
b)SERVICE_PORT_NAME
c)WSDL_LOCATION
d)SERVICE_NAME

DOUBT:

When we don't know any thing about the target Web service at the time of writing of Web Service Client,then how will the JAXBContext reference be initialized.
I mean we don't have generated any JAXB wrapper classes and in fact we don't want our client to be tied to a specific set of JAXB generated classes

JAXBContext theJaxbContext =JAXBContext.newInstance("com.ivan.calculator");
Dispatch<Object> theDispatch =theService.createDispatch(theName, theJaxbContext,Service.Mode.PAYLOAD);



can you please elaborate how it will be taken care of?
I am unable to understand how this JAXBContext aspect will be catered.

Thanks in Advance

Regards

Jolly
Hi! Ivan,

This is related to the client communication model from your Guide.
I was trying invocation of service operation via Invoke() of Dispatch Interface in a synchronous manner.

QUERY

1. What i understood from the topic in the notes is that we must have JAXB generated classes with us before we execute this kind of client and we have to pass the package name of the generated classes to the JAXBContext("abc.def").Am i correct?
I think we can generate them with wsimport pretty easily.

2.Do we have some programming api , using which we can generate these JAXB classes.

3.When we can go for service operation invocation via PROXY mechanism which is far easier from programmer's perspective, why will some one go for this approach for Synchronous call.Can you please elaborate with some scenario so that we could understand it.


Thanks in Advance


Regards

Jolly
Hi!

In case of SCDJWS , what i feel is ,experience in web services gives you an added advantage.But its not that you can't do without it .

My First advice is before starting any book , just go through XML and XSD related tutorials.Understand the basic concept of this covering XSD and namespace,complex types.

Then you can start with Ivan's Guide which you can download from this forum also and you can refer MZ notes.
As no reference book is available specifically for this exam ,They are going to be of great use.

Ivan's Guide
http://www.javaforum.se/jforum/posts/list/549.page

MZ's Note
http://java.boot.by/scdjws5-guide/index.html

To kick start your preparation just start with this
http://www.w3schools.com/xml/xml_whatis.asp

Rest this forum is very informative you will get a lot here itself

Regards
Jolly
Thanks Ivan for your quick response

Well that means one of the class generated by wsimport,StringProcessorPort is fine.

public ReverseStringResponse reverseString(
@WebParam(name = "reverseStringReq", targetNamespace = "http://www.instinct.com/stringprocessor", partName = "parameters")
ReverseStringRequest parameters);



To invoke this service operation through Proxy mechanism , We will have to create an instance of JAXB mapping class for Request data and then call its setter method to provide input data which is a String in this case.



Query
What changes need to be done to enable the client to invoke service operation as follows

StringProcessorService srvc=new StringProcessorService();
StringProcessorPort port=srvc.getStringProcessorPort();
String res=port.reverseString("Hello");




Please correct me wherever you feel i am wrong as that would be of great help.

Regards

Jolly
Hi! Everyone,

I have a query regarding the Artifacts (especially the Port class) generated by wsimport.
I took following two documents :
1. StringProcessorService.wsdl
2. StringProcessorService_Payload.xsd

Reference: snippets taken from IVAN's guide

I Placed both the documents in a directory and then executed wsimport on my command prompt:

c:\wsdl\>wsimport -p clientside -s . StringProcessorService.wsdl


StringProcessorService.wsdl




StringProcessorService_Payload.xsd



Doubt:
When I am looking at the code generated inside the Port class(StringProcessorPort.java) I found following

public ReverseStringResponse reverseString(
@WebParam(name = "reverseStringReq", targetNamespace = "http://www.instinct.com/stringprocessor", partName = "parameters")
ReverseStringRequest parameters);

The parameters and return type are of ReverseStringRequest and ReverseStringResponse respectively.
I guess the wsdl and xsd tells that they should be of String type.

Please correct me if i am wrong.

Regards

Jolly
Hi! Ivan,

Note that what appears in the build/classes directory are the compiled class-files of the generated classes.



Perhaps i am not able to claear my query.Actually my concern is about the generated wrapper classes which
are residing in the wsgen-output dierctory which is inside build directory but outside classes directory.
how does these wrapper classes generated by wsgen get bundled (being outside classes directory)

Regards

Jolly
Thanks Ivan...

your piece of advice really worked

Actually i was not refreshing the work bench but why was it not reloading the whole environment
when we reopen it after closing, I mean it should take the current configuration and show all
the artifacts.
Anyway i am able to run basic Web service now using Eclipse and glass fish.
I have few more queries regarding it:

1.following your example i made a wsgen-output directory inside the build folder (now i am having two directories inside build:-classes and wsgen-output).
build
|
---classes
|
---wsgen-output
in this wsgen-output directory i am clearly viewing those wrapper classes .
Though my program is running fine , But i want to understand how server Run time environment is able to
use those generated classes when they are not even inside the classes folder.I mean how does it pick those wsgen generated classes residing in wsgen-output folder inside build?

2. Where can we find that bundled(archieved) file for the web service application inside the glassfish server environment.it would be keeping it somewhere at the time of deployment.I am not able to find out that.

3.I am using glassfish tools bundle for Eclipse 1.1 to try out your code snippets.
it contains two server versions
glassfish server v2.1
glassfish server v3 preclude

I am using glassfish server v2.1.is it fine?

Please guide me on the above mentioned points..

Thanks and Regards

Jolly


Hi! Ivan,


I have downloaded glassfish tools bundle for Eclipse 1.1 and have installed it.I started trying out
First code from your guide(First code from sec 4.7 creating web services with JAX-WS)
As i am new to this IDE environment my questions may seem a bit trivial to you people,i had been coding
on textpad and using Web logic as a app server.Any ways..

Inside my workspace I am able to see four directories .settings,build,src,WebContent

I have written a file through IDE, com.instinct.Calc(.java ) and it is placed in src directory

I wrote a build.xml file following your instructions and placed it within src/com/instinct/

So I have got 2 files inside src/com/instinct/
calc.java(SIB)
build.xml

After right clicking on the build.xml file and then clicking on Ant build file the files
are generated in the designated locations mentioned in the build file.

Now my concerns are regarding this:

<!-- Default output directory for artifacts generated by wsgen. -->
<property name="wsgen-outdir" value="${basedir}/build/wsgen-output/"/>
(Section from build.xml from your guide)

After execution of build.xml ,I am able to see two directories in build directory.
classes folder and wsgen-output folder
I am able to see requestWrapper and responseWrapper classes in wsgen-output directory

1. As you have told to edit them i am not able to view them inside my IDE so shall i update them
out of the IDE and compile them separately?


2. As these wsgen classes are residing in the wsgen-output folder inside build folder.and classes folder is also
at the same level at wsgen-output.So will the runtime environment able to find those classes as they are not
within classes folder.


3. When I am trying to deploy this project by clicking on RunAs it fails saying Unable to find CalcSrvc.wsdl even
though CalcSrvc.wsdl has been generated within WebContent/WEB-INF folder


Please guide me in getting started and please correct me where ever I have commited some mistake during all this .


Thanks and Regards

Jolly
Hi!

I was trying to configure environment for running ivan's guide code snippet.
Can any body guide me which version of Eclipse and Glass Fish , I should download to make them run.
I am totally new to GlassFish and please tell me how i can integrate glass fish with Eclipse.


Thanks & Regards
Jolly