on 09-11-2014 6:35 AM
Hello Experts,
I'm using '@WebServiceRef' in my Web Module.
Sometimes the 'service' object is null.
public class WsStaffMobile {
@WebServiceRef (name="WsAuthUserWebService") WsAuthUserService service;
public UserDetails getUserDetails(@WebParam(name = "userName") String userName, @WebParam(name = "password") String password) {
WsAuthUser port = service.getWsAuthUserPort();
UserDetails userDetails = port.getUserDetails(userName, password);
return userDetails;
}
As a workaround I'm using JNDI (from this thread: http://scn.sap.com/thread/1716058) and it's working but how can I use annotation and injection and reinitialize the object (if needed)?
J2EE version is 7.31 SP7.
Regards,
Omri
Hi Omri,
How did your Issue got Solved ?
Thanks,
Nagishetty
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Omri,
Are you instantiate your WsStaffMobile with new?
I am not sure if the injection would work in this case.
For example if you would be using FooImplBean class generated from WSDL and call this ImplBean class as a web service reference and in this class you would have your service variable injected, than i would work.
So in your EJB project, after importing WSDLs, after generating client and java bean skeleton, you will get this code at some point, see below. In this code you will inject the service variable and call this service after retrieving port(after deployment and configuration in NWA).
@SessionHandlingDT(enableSession = false)
@AuthenticationDT(authenticationLevel = AuthenticationEnumsAuthenticationLevel.BASIC)
@TransportGuaranteeDT(level = TransportGuaranteeEnumsLevel.NONE)
@WebService(portName = "Foo_IN_Port", serviceName = "Foo_IN_Service", endpointInterface = "com.test.FooIN", targetNamespace = "http://com.test", wsdlLocation = "META-INF/wsdl/com/test/Foo_IN/Foo_IN.wsdl")
@Stateless
public class FooINImplBean {
@WebServiceRef(name="FooResponse")
FooService service;
@RelMessagingNW05DTOperation(enableWSRM = false)
public com.test.Response fooIN(com.test.RequDT foo_Requ_MT)throws com.test.fooFT_Exception {
FooOUT port = service.getFoo_OUT_Port();
FooRequDT requ = new FooRequDT();
Response resp = port.fooOUT(requ);
return resp;
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
No, I didn't solve it.
I raised an OSS and they told me that this is a "consulting issue" so I ended up using the workaround and it works.
Regards,
Omri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Omri,
Did you solve this problem of NullPointerException?
cheers
simon 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.