June 26, 2013

Error: Page template name already used in library


I have created a page template with name “PageTemplate.jspx” in JDeveloper for my application, but I deleted the file later. Again when I tried to create a page template with the same name “PageTemplate.jspx”  in the application then I got the below validation error “Page template name already used in library”.





Even if we delete the file from JDeveloper, entries from some configuration files may not be deleted. Hence, we get this error.
There are two solutions for this.
The simplest one is to give different name to the template :D .
Another one is,
  • Go to META-INF folder under Application Source of the project
  • Open the file “pagetemplate-metadata.xml”
  • You should find your pagetemplate entry with in the tags
     <pagetemplate-jsp-ui-def>…</pagetemplate-jsp-ui-def>
  • Remove the entry and save the xml file
  • Now you should be able to create the page template with the same name

June 22, 2013

Changing End point address of web service


Below code explains how to change the web service end point through program. 

ServiceRequestService serviceRequestService = new ServiceRequestService();
ServiceRequestPortType serviceRequestPortType =
serviceRequestService.getServiceRequestPortType(); 
BindingProvider bp = (BindingProvider)serviceRequestPortType;           
bp.getRequestContext().put(
BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
"http://localhost:9950/soa-infra/services/default/sr_v2/ServiceRequest.service");

 Here is the explanation for this code.
  • Get port object of the web service
  • Type cast the port object to BindingProvider object 
  • BindingProvider class provides a member method getRequestContext() which returns a map
  • This map holds all the attributes of the request context
  • Overwrite end point with new web service url which will replace the new end point with the old one.
Note: This code works only if the client style is RPC.

June 21, 2013

Using HTTP Analyzer



JDeveloper provides a tool called “Http Analyzer “ which is very useful when we are using web service in our application and if we want to see what input request, the application is being sent to server via web service.

To start using the “Http Analyzer”, please do the below steps.

  • Go to Tools menu of JDeveloper and select Http Analyzer
  • Click on “Start HTTP Analyzer” button (Green button like arrow)
  • Start the Integrated web logic server and run the application
  • Do the necessary actions to invoke webservice integrated in the application
  • Now we can see request sent is logged in the HTTP Analyzer
  • Click on the request, it will open the XML request being sent to the server