cancel
Showing results for 
Search instead for 
Did you mean: 

Error calling Webservice with SSO

Former Member
0 Kudos

Hello everybody,

I have WAS 6.40 SP13 installed. I have NWDS sp12.

I have imported Car rental tutorial which includes Authentication and authorization code. This tutorial has implemented SSO also between Webdynpro and Web service using SAP logon ticket.

I deployed this application on my server. This application works properly with SSO.

Now, i have created one webdynpro application and created Web service model for the same web service used in above project. I have specified same HTTP destination in code as specified in above tutprial project.

But when i am running my webdynpro application it is giving me Unauthorized error. Means, SSO between Webdynpro and web service not completed.

What could be the problem behind this?

Regards,

Bhavik

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I need not to include SSO ticket explicitly. This thing will be done by HTTP Destination.

I have resolved this problem. I missed one reference to this HTTP destination. I have added and now its working fine.

Regards,

Bhavik

Former Member
0 Kudos

Hi,

I think the problem is that ths SSO header is not added to security protocol when calling the web service. You can try this to add the ticket before calling the ws:

serviceImpl service = WebServiceModel.getServiceImpl();

yourServiceViDocument logicalPort = (yourServiceViDocument) service.getLogicalPort("Config1Port_Document" , yourServiceViDocument.class );

BaseGeneratedStub stubForLogicalPort = (BaseGeneratedStub) logicalPort ;

SecurityProtocol securityProtocol = (SecurityProtocol) stubForLogicalPort._getGlobalProtocols().getProtocol("SecurityProtocol");

securityProtocol.addHeader("Cookie","MYSAPSSO2="getSSOTicket()";");

private String getSSOTicket() {

IWDMessageManager msgMgr = wdThis.wdGetAPI().getComponent().getMessageManager();

try {

HttpServletRequest req = TaskBinder.getCurrentTask().getWebContextAdapter().getHttpServletRequest();

if (req != null)

return SSOSession.getSSOTicket(req);

else

return"";

} catch (Exception e) {

msgMgr.reportException(e.getLocalizedMessage(), true);

return "";

}

}