cancel
Showing results for 
Search instead for 
Did you mean: 

UWL API NW7.3 NullPointerException

Former Member
0 Kudos

Hello everybody,

i am trying to play around with the UWL Api. It's a local Server on NW7.3.

I referenced tc/kmc/bc.uwl/api in my Project. I created an Webservice which should create a new UWL Task. But i only get an NullPointerException and i don't know why.

Here's my Code:

@WebMethod(operationName = "createTask", exclude = false)

          public void createTask(@WebParam(name = "subject") String subject,

                              @WebParam(name = "description") String description) {

                    try {

                              Properties env = new Properties();

                              env.put(InitialContext.INITIAL_CONTEXT_FACTORY,

                                                  "com.sapportals.portal.prt.registry.PortalRegistryFactory");

                              // create initial context

                              InitialContext ctx = new InitialContext(env);

                              // retrieve UWL service

                              IUWLService uwlService = (IUWLService) ctx

                                                  .lookup("/broker/services/" + IUWLService.ALIAS_KEY);

                              // find logged in user, in my case it's the "guest" user

                              IUser loggedInUser = UMFactory.getAuthenticator().getLoggedInUser();

                              IPushChannel pushChannel = uwlService.getPushChannel();

                              IProviderConnector providerConnector = uwlService

                                                  .getRegisterProviderConnector(IProviderConnector.BPEM_CONNECTOR_ID);

                              Item item = new Item(providerConnector.getId(), "SAP_LocalSystem",

                                                  Long.toString(System.currentTimeMillis()),

                                                  "USER.PRIVATE_DATASOURCE.un:testUser");

                              item.setDescription(description);

                              item.setItemType(ItemType.UWL_ITEM_TASK);

                              item.setCreatedDate(new Date());

                              item.setCreatorId(loggedInUser.getUniqueID());

                              item.setRequiredAction(true);

                              item.setStatus(StatusEnum.INPROGRESS);

                              item.setExternalObjectId(String.valueOf(item.getInternalId()));

                              Set<String> users = new HashSet<String>();

                              users.add("USER.PRIVATE_DATASOURCE.un:testUser");

                              pushChannel.pushItems(providerConnector, loggedInUser,

                                                  ConnectorResult.createUnknownResult(new ItemCollection(

                                                                      Arrays.asList(item))));

                    } catch (NamingException ne) {

                              ne.printStackTrace();

                    } catch (UWLException uwle) {

                              uwle.printStackTrace();

                    }

          }

Notes to my Code:

  • "USER.PRIVATE_DATASOURCE.un:testUser" is a correct User-ID.
  • The Systemname "SAP_LocalSystem" and the Connector "BPEMUWLConnector" informations i have from the UWL->Show Connection Status Dialog.

The Response of this WebService is like that:

<SOAP-ENV:Envelope xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <SOAP-ENV:Body>

      <SOAP-ENV:Fault>

         <faultcode>SOAP-ENV:Client</faultcode>

         <faultstring>while trying to invoke the method com.sap.netweaver.bc.uwl.admin.IPropertiesManager$SystemProperty.getCacheEnabled() of an object returned from com.sap.netweaver.bc.uwl.core.ServicePropertiesManager.getSystemProperty(java.lang.String, java.lang.String)</faultstring>

         <detail>

            <yq1:java.lang.NullPointerException xmlns:yq1="http://sap-j2ee-engine/client-runtime-error">while trying to invoke the method com.sap.netweaver.bc.uwl.admin.IPropertiesManager$SystemProperty.getCacheEnabled() of an object returned from com.sap.netweaver.bc.uwl.core.ServicePropertiesManager.getSystemProperty(java.lang.String, java.lang.String)</yq1:java.lang.NullPointerException>

         </detail>

      </SOAP-ENV:Fault>

   </SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Thanks for your Help.

Best Regards,

Michael

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Well, got this to work. I forgot to create a session and used "pusheSharedItem" instead of "pushItems".

Items are added correctly to the uwl.

But if i refresh the uwl or logout and login, the items disappear.

It's like if they are not finally commited?

Is there a commit method or something else i forgot?

Thanks.