Skip to Content
0
Former Member
Jul 20, 2008 at 11:51 AM

Question about implementation of a webservice

10 Views

Hi

I have successful implemented a webservice call in my webdnypro application. But I am not sure if I have done this the right way 😊

Scenario: I have a view which displays data from a business partner. These data can be accessed over a webservice. The webservice requires a parameter with the id of the bussiness partner.

My solution: I have implemented a method in the component controller (*comp.java).

public void getBusinessPartnerInfo( java.lang.String businessPartnerCode )  {
    //@@begin getBusinessPartnerInfo()
	  
	  service = new BPService();
	  
	  Request_GetBPInfo request = new Request_GetBPInfo(service);
	  GetBPInfo getBPInfo = new GetBPInfo(service);
	  getBPInfo.setCardCode(businessPartnerCode);
	  request.setGetBPInfo(getBPInfo);

	  try {
		  request.execute();
	  } catch(WDWSModelExecuteException ex) {
		  
	  }
	  
	  wdContext.nodeRequest_GetBPInfo().bind(request);
	  
    //@@end
  }

and I invoke this method from the wdInit method of the same controller.

public void wdDoInit()
  {
    //@@begin wdDoInit()
	  
	  this.getBusinessPartnerInfo("c1000");
	  
    //@@end
  }

Therefor the data is available when the view is loaded. But I am asking myself if this is the right way to do that? Wouldn't it be better to call this webservice invocation from the init method of the view?

Additionally I do not know at the moment how to access the environment of the portal for information. E.g. the business partner code c1000 is hard coded at the moment. I would like to read this code from the environment, e.g. the portal. Over which API can I access data from the portal or better say from the ume (where i can map a field to the business partner code)?

Thanks for your answers,

Thierry