Wednesday, September 21, 2011

Registering a Web Service with Oracle Enterprise Gateway (OEG)

Simple sanity test for OEG install.

I have created and deployed a simple creditCardValidation service to

http://localhost:7001/ValidateCC/ValidateCCPort?WSDL

The impl is as follows -

package validatecc;

public class ValidateCC {
public ValidateCC() {
super();
}
public CreditCardValidation validateCard(String cardType, String cardNr){
CreditCardValidation ccv = new CreditCardValidation();
ccv.setStatus("INVALID");

if (cardType.equalsIgnoreCase("AMEX")){
ccv.setValidFrom("20110101");
ccv.setValidUntil("20150101");
ccv.setCustName("NiallC");
ccv.setLimit(10000);
ccv.setStatus("VALID");

}
if (cardType.equalsIgnoreCase("VISA")){
ccv.setValidFrom("20070101");
ccv.setValidUntil("20110101");
ccv.setCustName("NiallC");
ccv.setLimit(7000);
ccv.setStatus("VALID");

}
return ccv;
}
}

package validatecc;

public class CreditCardValidation {
String validFrom;
String validUntil;
String custName;
String status;
int limit;

public CreditCardValidation() {
super();
}

public void setValidFrom(String validFrom) {
this.validFrom = validFrom;
}

public String getValidFrom() {
return validFrom;
}

public void setValidUntil(String validUntil) {
this.validUntil = validUntil;
}

public String getValidUntil() {
return validUntil;
}

public void setCustName(String custName) {
this.custName = custName;
}

public String getCustName() {
return custName;
}

public void setLimit(int limit) {
this.limit = limit;
}

public int getLimit() {
return limit;
}

public void setStatus(String status) {
this.status = status;
}

public String getStatus() {
return status;
}
}

Simple enough!

Steps

Start up the Gateway & Policy Studio

Gateway startup --> \OEG\Gateway\enterprisegateway\Win32\bin\enterprisegateway.bat
Policy Studio Startup --> \OEG\PolicyStudio\oegpolicystudio\policystudio.exe



Click on the Edit Active Configuration link
This loads the current Gateway configuration into Policy Studio.

Click on Policies
Click on Register Web Service








This is just a simple pass through example so de-select teh "secure" checkbox.



Check the routing settings




As you can see, this is simple pass-thru processing.

Now deploy the changes from Policy Studio to the Gateway.




Review what has been generated -



Right Click on the Service Handler --> Edit



Click on the Validation tab



Test using Service Explorer

I didn't cover the install of Service Explorer in my "OEG Install" blog post.
It is just a case of unzipping the file - Oracle_Enterprise_Gateway_11_1_1_5_0_Win32_Service_Explorer.zip to a directory of your choice.

Start -




You are presented with an empty page - ready for exploring!




Menu --> File --> Load WSDL

Here we load our original WSDL.




Change the Request, adding valid cardType etc.





Click on the drop down list beside the green icon




Change to point to OEG
http://8082/ValidateCC/ValidateCCPort
The default port for OEG is 8080, however I changed this to 8082, as I had a DB service running on 8080.



Validate the response





Monitor the Gateway





admin/changeme
Click on View Reports

No comments: