Hi,
I implement bipro ws client. First I call security token
I have problems on response. I cannot get a RequestedSecurityToken object,
because the "any" parameter is ElementNSImpl. By return a type he get a
null.
My Client implementation: 

public class WSClient {

        public static void main(String[] args) throws Exception {
                XTrustProvider.install();
                UsernamePasswordLoginXX service = new UsernamePasswordLoginXXX(
                                new URL(
                                                "urlXXXX?wsdl"),
                                new QName("http://www.bipro.net/namespace";,
"UsernamePasswordLogin_XXXX"));

                SecurityTokenServicePortType port = 
service.getUserPasswordLogin();

                org.xmlsoap.schemas.ws._2005._02.trust.ObjectFactory 
trustFactory = new
ObjectFactory();
                JAXBElement<String> elementTokenType = trustFactory
                                
.createTokenType("http://schemas.xmlsoap.org/ws/2005/02/sc/sct";);
                JAXBElement<String> elementRequestType = trustFactory
                                
.createRequestType("http://schemas.xmlsoap.org/ws/2005/02/trust/Issue";);

                RequestSecurityTokenType parameters = new 
RequestSecurityTokenType();
        
parameters.setContext("xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\"";);
                parameters.getAny().add(elementTokenType);
                parameters.getAny().add(elementRequestType);

                QName BiPROVersion_QNAME = new
QName("http://www.bipro.net/namespace/allgemein";,
                                "BiPROVersion");
                JAXBElement<String> elementBiproVersion = new
JAXBElement<String>(BiPROVersion_QNAME,
                                String.class, null, "XXXX");
                parameters.getAny().add(elementBiproVersion);

                QName RequestType_QNAME = new
QName("http://schemas.xmlsoap.org/ws/2005/02/trust";,
                                "RequestType");

                Map<QName, String> attributes = parameters.getOtherAttributes();
                attributes.put(RequestType_QNAME, "wst");

                Holder<RequestSecurityTokenResponseType> parameters0 = new
Holder<RequestSecurityTokenResponseType>();

                port.requestSecurityToken(parameters, parameters0);

                List objectList = parameters0.value.getAny();
                for (Object object : objectList) {
                        if (object instanceof JAXBElement) {
                                JAXBElement element = (JAXBElement) object;
                                Object valueObject = element.getValue();
                                if (valueObject instanceof LifetimeType) {
                                        LifetimeType lifetimeType = 
(LifetimeType) valueObject;
                                        System.out.println("Create: " + 
lifetimeType.getCreated().getValue()
                                                        + " Expires: " + 
lifetimeType.getExpires().getValue());
                                }
                                if (valueObject instanceof 
RequestedSecurityTokenType) {
                                        RequestedSecurityTokenType estt = 
(RequestedSecurityTokenType)
valueObject;
                                        System.out.println("Obj: " + 
estt.getAny());
                                }
                                System.out.println("Obj: " + 
valueObject.toString());
                        }
                }

        }
}
Output: 

Obj: http://schemas.xmlsoap.org/ws/2005/02/sc/sct
Create: 2014-02-19T17:43:46 Expires: 2014-02-19T21:43:46
Obj: org.xmlsoap.schemas.ws._2005._02.trust.LifetimeType@3c789d63
Obj: [wsc:SecurityContextToken: null]
Obj:
org.xmlsoap.schemas.ws._2005._02.trust.RequestedSecurityTokenType@12a4ed99

Is this a right way to get the STS?





--
View this message in context: 
http://cxf.547215.n5.nabble.com/Response-Java-Object-ElementNSImpl-problem-tp5740171.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Reply via email to