A Sample Files
Sample Application.wadl File
<?xml version="1.0" encoding="ISO-8859-1"?> <ns0:application xmlns:ns0="http://wadl.dev.java.net/2009/02"> <ns0:doc ns1:generatedBy="Jersey: 2.22.4 2016-11-30 13:33:53" xmlns:ns1="http://jersey.java.net/"/> <ns0:doc ns2:hint="This is simplified WADL with user and core resources only. To get full WADL with extended resources use the query parameter detail. Link: http://abc.us.oracle.com:8003/rib-injector-services-web/resources/application.wadl?detail=true" xmlns:ns2="http://jersey.java.net/"/> <ns0:grammars> <ns0:include href="application.wadl/xsd0.xsd"> <ns0:doc title="Generated" xml:lang="en"/> </ns0:include> </ns0:grammars> <ns0:resources base="http://abc.us.oracle.com:8003/rib-injector-services-web/resources/"> <ns0:resource path="discover"> <ns0:method id="discoverAllResources" name="GET"> <ns0:response> <ns0:representation mediaType="application/json"/> </ns0:response> </ns0:method> </ns0:resource> <ns0:resource path="/injector"> <ns0:resource path="/inject"> <ns0:method id="injectMessage" name="POST"> <ns0:request> <ns0:representation mediaType="application/xml" element="ns3:ApplicationMessage" xmlns:ns3="http://www.oracle.com/retail/integration/rib/ApplicationMessages/v1"/> </ns0:request> <ns0:response> <ns0:representation mediaType="*/*"/> </ns0:response> </ns0:method> </ns0:resource> <ns0:resource path="/ping"> <ns0:method id="ping" name="GET"> <ns0:request> <ns0:param name="pingMessage" default="hello" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema" style="query"/> </ns0:request> <ns0:response> <ns0:representation mediaType="application/json"/> </ns0:response> </ns0:method> </ns0:resource> </ns0:resource> </ns0:resources> </ns0:application>
Sample Resource Class
package com.oracle.retail.rib.integration.services.applicationmessageinjector; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import com.oracle.retail.integration.rib.applicationmessages.v1.*; import com.retek.rib.binding.exception.InjectorException; import com.retek.rib.binding.injector.Injector; import com.retek.rib.binding.injector.InjectorFactory; import com.retek.rib.domain.payload.PayloadFactory; import javax.ws.rs.DefaultValue; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.oracle.retail.integration.payload.Payload; @Stateless @Path("/injector") public class ApplicationMessageInjectorResource { private static Log LOG = LogFactory.getLog(ApplicationMessageInjectorResource.class); @GET @Path("/ping") @Produces({MediaType.APPLICATION_JSON}) public Response ping(@DefaultValue("hello") @QueryParam("pingMessage") String pingMessage){ String message = "{\"message\": \"Got " + pingMessage + " from server.\"}"; return Response.ok(message, MediaType.APPLICATION_JSON).build(); } @POST @Path("/inject") @Consumes({MediaType.APPLICATION_XML}) public Response injectMessage(ApplicationMessage applicationMessage) throws InjectorException{ verifyNotNull(applicationMessage, "applicationMessage"); invokeInjectForMessageType(applicationMessage.getFamily(), applicationMessage.getType(), applicationMessage.getBusinessObjectId(), applicationMessage.getPayloadXml()); String message = "{\"message\": \"Inject successful.\"}"; return Response.ok(message, MediaType.APPLICATION_JSON).build(); } private void invokeInjectForMessageType(String family, String messageType, String businessObjectId, String retailPayload)throws InjectorException{ try { verifyNotNull(family, "family"); verifyNotNull(messageType, "messageType"); verifyNotNull(retailPayload, "retailPayload"); Payload payload = PayloadFactory.unmarshalPayload(family, messageType, retailPayload); Injector injector = InjectorFactory.getInstance().getInjector( ?? family, messageType); if (injector == null) { final String eMsg = "Unknown message" + " family/type: " + family + "/" + messageType; LOG.error(eMsg); throw new InjectorException(eMsg); } if(LOG.isDebugEnabled()){ LOG.debug("Received inject call for family("+family+") type("+messageType+") businessObjectId("+businessObjectId+") with payload:\n" + payload.toString()); } injector.inject(messageType, businessObjectId, payload); LOG.debug("Inject call for family("+family+") type("+messageType+") businessObjectId("+businessObjectId+") return."); ?? } catch (InjectorException e) { final String eMsg = "Exception calling inject."; LOG.error(eMsg, e); throw e; }catch (Exception re) { final String eMsg = "Exception calling inject."; LOG.error(eMsg, re); throw new RuntimeException(eMsg, re); } } private void verifyNotNull(Object field, String fieldName){ if(field == null){ final String eMsg = fieldName + " cannot be null."; LOG.error(eMsg); throw new IllegalArgumentException(eMsg); } } }
ApplicationMessages.xsd
<?xml version="1.0" encoding="UTF-8" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.oracle.com/retail/integration/rib/ApplicationMessages/v1" xmlns:rib="http://www.oracle.com/retail/integration/rib/ApplicationMessages/v1" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" jaxb:extensionBindingPrefixes="xjc" jaxb:version="2.0" targetNamespace="http://www.oracle.com/retail/integration/rib/ApplicationMessages/v1" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:annotation> <xs:appinfo> <jaxb:globalBindings fixedAttributeAsConstantProperty="false" choiceContentProperty="true" enableFailFastCheck="true" generateIsSetMethod="true " enableValidation="true"> <!--xjc:javaType name="java.util.Calendar" xmlType="xs:dateTime" adapter="com.oracle.retail.integration.rib.rib_integration_runtime_info.datatypeadapter.CalendarAdapter"/ --> <jaxb:serializable uid="1"/> </jaxb:globalBindings> <!--jaxb:schemaBindings> <jaxb:package name="com.oracle.retail.integration.rib.ribintegrationruntimeinfo" /> </jaxb:schemaBindings--> </xs:appinfo> </xs:annotation> <xs:element name="ApplicationMessages"> <xs:complexType> <xs:sequence> <xs:element ref="ApplicationMessage" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="ApplicationMessage"> <xs:complexType> <xs:sequence> <xs:element name="family" type="string25"/> <xs:element name="type" type="string30"/> <xs:element name="businessObjectId" type="string255" minOccurs="0"/> <xs:element ref="ApplicationMessageRoutingInfo" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="payloadXml" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="ApplicationMessageRoutingInfo"> <xs:complexType> <xs:sequence> <xs:element name="name" type="string25"/> <xs:element name="value" type="string25"/> <xs:element ref="ApplicationMessageRoutingInfoDetail" minOccurs="0" maxOccurs="2"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="ApplicationMessageRoutingInfoDetail"> <xs:complexType> <xs:sequence> <xs:element name="name" type="string25"/> <xs:element name="value" type="string300"/> </xs:sequence> </xs:complexType> </xs:element> <xs:simpleType name="string255"> <xs:restriction base="xs:string"> <xs:maxLength value="255" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="string25"> <xs:restriction base="xs:string"> <xs:maxLength value="25" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="string30"> <xs:restriction base="xs:string"> <xs:maxLength value="30" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="string300"> <xs:restriction base="xs:string"> <xs:maxLength value="300" /> </xs:restriction> </xs:simpleType> </xs:schema>
Rest Publisher Pseudo Code
//Import required classes import com.oracle.retail.integration.base.bo.fulfilorddesc.v1.* import com.oracle.retail.integration.payload.Payload import com.retek.rib.domain.payload.PayloadFactory import com.oracle.retail.integration.rib.applicationmessages.v1.ApplicationMessage; import com.oracle.retail.integration.rib.applicationmessages.v1.ApplicationMessages; //Create new instance of your FulfilOrdDesc object and populate it. FulfilOrdDesc fulfilOrdDesc = new FulfilOrdDesc() fulfilOrdDesc.setCustomerOrderNo(123) //Get a string version of the payload String payloadXml = PayloadFactory.marshalPayload(fulfilOrdDesc) //Prepare the header message section ApplicationMessages ams = new ApplicationMessages(); ApplicationMessage am = new ApplicationMessage(); am.setFamily("FULFILORD"); am.setType("FULFILORDPOCRE"); am.setBusinessObjectId("abc"); //optional //Set the payload xml into the message am.setPayloadXml(payloadXml); ams.getApplicationMessage().add(am); //Call rest url with ams String ribPublisherRestUrl = "http://<host>:<port>/rib-ext-services-web/resources/publisher/publish" Client client = ClientBuilder.newClient(); WebTarget webTarget = client.target(ribPublisherRestUrl); String userName = "user"; char[] password = "passed"; String usernameAndPassword = userName + ":" + new String(password); String authorizationHeaderValue = "Basic " + java.util.Base64.getEncoder().encodeToString( usernameAndPassword.getBytes() ); Invocation.Builder invocationBuilder = webTarget.request().header("Authorization", authorizationHeaderValue); Response response = invocationBuilder.post(Entity.entity(ams, MediaType.APPLICATION_XML)); log.debug("Publish call response(" + response + ").");
payload.properties
ASNIN.ASNINCRE=com.oracle.retail.integration.base.bo.asnindesc.v1.ASNInDesc ASNIN.ASNINDEL=com.oracle.retail.integration.base.bo.asninref.v1.ASNInRef ASNIN.ASNINMOD=com.oracle.retail.integration.base.bo.asnindesc.v1.ASNInDesc WH.WHCRE=com.oracle.retail.integration.base.bo.whdesc.v1.WHDesc WH.WHDEL=com.oracle.retail.integration.base.bo.whref.v1.WHRef WH.WHMOD=com.oracle.retail.integration.base.bo.whdesc.v1.WHDesc
Sample Request/Response for ReST Injector Service
Table A-1 Sample Request/Response for ReST Injector Service
End Point | Method | Media Type | User/ Password | Request xml | Response | Comments |
---|---|---|---|---|---|---|
http://localhost:7001/rib-injector-services-web/resources/injector/inject |
POST |
application/xml Request are xml only and response are json only. |
A valid user that is part of IntegrationGroup. |
<ApplicationMessage xmlns="http://www.oracle.com/retail/integration/rib/ApplicationMessages/v1"> <family>Vendor</family> <type>VendorCre</type> <businessObjectId>10111011</businessObjectId> <payloadXml><VendorDesc xmlns="http://www.oracle.com/retail/integration/base/bo/VendorDesc/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><ns1:VendorHdrDesc xmlns:ns1="http://www.oracle.com/retail/integration/base/bo/VendorHdrDesc/v1" ><ns1:supplier>10111011</ns1:supplier><ns1:sup_name>supplier site |
HTTP/1.1 200 OK Date: Thu, 10 May 2018 16:33:11 GMT Content-Length: 33 Content-Type: application/json X-ORACLE-DMS-ECID: 4a8e5d3f-1aae-43d7-ba84-c6b9c60563c7-00000039 X-ORACLE-DMS-RID: 0 Set-Cookie: JSES-SIONID=hsFK5jW4B1QtipC9zhng--or1WL7ywxCuxsJeVwdgPpnv6oNUnde!233126712; path=/; HttpOnly {"message": "In-ject successful."} |
Success |
</ns1:sup_name><ns1:contact_name>G Srilekha</ns1:contact_name><ns1:contact_phone>1234567</ns1:contact_phone><ns1:sup_status>A</ns1:sup_status><ns1:qc_ind>N</ns1:qc_ind><ns1:vc_ind>N</ns1:vc_ind><ns1:currency_code>PLN</ns1:currency_code><ns1:terms>Net_07</ns1:terms><ns1:freight_terms>F_01</ns1:freight_terms><ns1:ret_allow_ind>N</ns1:ret_allow_ind><ns1:ret_auth_req>Y</ns1:ret_auth_req><ns1:edi_po_ind>N</ns1:edi_po_ind><ns1:edi_po_chg>N</ns1:edi_po_chg><ns1:edi_po_confirm>N</ns1:edi_po_confirm><ns1:edi_ |
||||||
asn>N</ns1:edi_asn><ns1:edi_supp_available_ind>N</ns1:edi_supp_available_ind><ns1:edi_contract_ind>N</ns1:edi_contract_ind><ns1:edi_invc_ind>N</ns1:edi_invc_ind><ns1:cost_chg_pct_var>0</ns1:cost_chg_pct_var><ns1:cost_chg_amt_var>0</ns1:cost_chg_amt_var><ns1:replen_approval_ind>N</ns1:replen_approval_ind><ns1:settlement_code>E</ns1:settlement_code><ns1:pre_mark_ind>N</ns1:pre_mark_ind><ns1:auto_appr_invc_ind>N</ns1:auto_appr_invc_ind><ns1:dbt_memo_code>Y</ns1:dbt_memo_code><ns1:freight_charge_ind>N</ns1:freight_charge_ind><ns1:auto_appr_dbt_memo_ind>N</ns1:auto_appr_dbt_memo_ind><ns1:inv_mgmt |
||||||
_lvl>S</ns1:inv_mgmt_lvl><ns1:backorder_ind>N</ns1:backorder_ind><ns1:vat_region>1002</ns1:vat_region><ns1:prepay_invc_ind>N</ns1:prepay_invc_ind><ns1:service_perf_req_ind>N</ns1:service_perf_req_ind><ns1:addinvc_gross_net >N</ns1:addinvc_gross_net><ns1:delivery_policy>NEXT</ns1:delivery_policy><ns1:bracket_costing_ind>N</ns1:bracket_costing_ind><ns1:dsd_supplier_ind>N</ns1:dsd_supplier_ind><ns1:sup_qty_level>CA</ns1:sup_qty_level><ns1:supplier_parent>1011101</ns1:supplier_parent><ns1:final_dest_ind>N</ns1:final_dest_ind></ns1:VenVendorHdrDesc><ns1:VendorAddrDesc |
||||||
xmlns:ns1="http://www.oracle.com/retail/integration/base/bo/VendorAddrDesc/v1" ><ns1:module>SUPP</ns1:module><ns1:key_value_1>10111011</ns1:key_value_1><ns1:seq_no>1</ns1:seq_no><ns1:addr_type>01</ns1:addr_type><ns1:primary_addr_ind>Y</ns1:primary_addr_ind><ns1:add_1>3/4/678</ns1:add_1><ns1:city>AE</ns1:city><ns1:country_id>PL</ns1:country_id></ns1:VendorAddrDesc><ns1:VendorAddrDesc xmlns:ns1="http://www.oracle.com/retail/integration/base/bo/VendorAddrDesc/v1" ><ns1:module>SUPP</ns1:module><ns1:key_value_1>10111011</ns1:key_value_1><ns1:seq_no>1</ns1:seq_no><ns1:addr_type>03</ns1:addr_type><ns1:primary_addr_ind>Y</ns1:primary_addr_ind><ns1:add_1>3/4/678</ns1:add_1><ns1:city>AE</ns1:city><ns1:country_id>PL</ns1:country_id></ns1:VendorAddrDesc><ns1:VendorAddrDesc |
||||||
xmlns:ns1="http://www.oracle.com/retail/integration/base/bo/VendorAddrDesc/v1" ><ns1:module>SUPP</ns1:module><ns1:key_value_1>10111011</ns1:key_value_1><ns1:seq_no>1</ns1:seq_no><ns1:addr_type>04</ns1:addr_type><ns1:primary_addr_ind>Y</ns1:primary_addr_ind><ns1:add_1>3/4/678</ns1:add_1><ns1:city>AE</ns1:city><ns1:country_id>PL</ns1:country_id></ns1:VendorAddrDesc><ns1:VendorAddrDesc |
||||||
xmlns:ns1="http://www.oracle.com/retail/integration/base/bo/VendorAddrDesc/v1" ><ns1:module>SUPP</ns1:module><ns1: key_value_1>10111011</ns1:key_value_1><ns1:seq_no>1</ns1:seq_no><ns1:addr_type>05</ns1:addr_type><ns1:primary_addr_ind>Y</ns1:primary_addr_ind><ns1:add_1>3/4/678</ns1:add_1><ns1:city>AE</ns1:city><ns1:country_id>PL</ns1:country_id></ns1:VendorAddrDesc><ns1:VendorAddrDesc |
||||||
xmlns:ns1="http://www.oracle.com/retail/integration/base/bo/VendorAddrDesc/v1" ><ns1:module>SUPP</ns1:module><ns1:key_value_1>10111011</ns1:key_value_1><ns1:seq_no>1</ns1:seq_no><ns1:addr_type>06</ns1:addr_type><ns1:primary_addr_ind>Y</ns1:primary_addr_ind><ns1:add_1>3/4/678</ns1:add_1><ns1:city>AE</ns1:city><ns1:country_id>PL</ns1:country_id></ns1:VendorAddrDesc><ns1:VendorOUDesc |
||||||
xmlns:ns1="http://www.oracle.com/retail/integration/base/bo/VendorOUDesc/v1" ><ns1:org_unit_id>1</ns1:org_unit_id><ns1:primary_pay_site_ind>N</ns1:primary_pay_site_ind></ns1:VendorOUDesc></VendorDesc></payloadXml> </ApplicationMessage> |
||||||
<stockholding_ind>a</stockholding_ind> <item_id>nbYDUFLqAcTsBUnhYuhpcæ±</item_id> <origi-nal_item_id>UxrgzyAgzDgTDbHfMBjbtæ±</original_item_id> <order_line_nbr>3</order_line_nbr> <unit_qty>12.4</unit_qty> <status>a</status> <us-er_id>CAswTBGUzTaNjwgDwWXEgqCjEmæ±</user_id> <updat-ed_date>2013-06-13T14:20:35</updated_date> </SOStatusDtl> <context_type>vRæ±</context_type> <con-text_value>oDHGRuOeDmvFPytxgiiJyæ±</context_value> <inventory_type>kwæ±</inventory_type> <cust_order_nbr>cwFLuXBqFPBvkxVmTSBrhovrROJAZYCfYncVEhfub-mAYæ±</cust_order_nbr> |
||||||
<fulfill_order_nbr>qSzQUPkqbEFboWQFxPSqoZ-NOEJotCMnqbWzXTqRVkVkLæ±</fulfill_order_nbr> </SOStatusDesc> ]]></payloadXml> </ApplicationMessage> |
||||||
If user in not added in IntegrationGroup |
<v1:ApplicationMessage xmlns:v1="http://www.oracle.com/retail/integration/rib/ApplicationMessages/v1"> <v1:family>WH</v1:family> <v1:type>WHCR</v1:type> <!--Optional:--> <v1:businessObjectId>?</v1:businessObjectId> <!--Zero or more repetitions:--> <v1:ApplicationMessageRoutingInfo> <v1:name>?</v1:name> <v1:value>?</v1:value> <!--Zero or more repetitions:--> <v1:ApplicationMessageRoutingInfoDetail> <v1:name>?</v1:name> <v1:value>?</v1:value> </v1:ApplicationMessageRoutingInfoDetail> </v1:ApplicationMessageRoutingInfo> <v1:payloadXml><WHDesc xmlns="http://www.oracle.com/retail/integration/base/bo/WHDesc/v1"><wh>10</wh><wh_name>g</wh_name></WHDesc></v1:payloadXml> </v1:ApplicationMessage> |
HTTP/1.1 403 Forbidden Date: Thu, 05 Aug 2021 10:25:26 GMT Content-Length: 1166 Content-Type: text/html; char-set=UTF-8 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Draft//EN"> <HTML> <HEAD> <TITLE>Error 403--Forbidden</TITLE> </HEAD> <BODY bgcol-or="white"> <FONT FACE=Helvetica><BR CLEAR=all> <TABLE bor-der=0 cellspac-ing=5><TR><TD><BR CLEAR=all> <FONT FACE="Helvetica" COL-OR="black" SIZE="3"><H2>Error 403--Forbidden</H2> </FONT></TD></TR> </TABLE> <TABLE bor-der=0 width=100% cellpad-ding=10><TR><TD VALIGN=top WIDTH=100% BGCOL-OR=white><FONT FACE="Courier New"><FONT FACE="Helvetica" SIZE="3"><H3>From RFC 2068 <i>Hypertext Transfer Protocol -- HTTP/1.1</i>:</H3> </FONT><FONT FACE="Helvetica" SIZE="3"><H4>10.4.4 403 For-bidden</H4> </FONT> |
Failure |
|||
<P><FONT FACE="Courier New">The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been ful-filled, it SHOULD de-scribe the reason for the refusal in the entity. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is ap-plica-ble.</FONT></P> </FONT></TD></TR> </TABLE> </BODY> </HTML> |
||||||
Wrong User/pass |
<v1:ApplicationMessage xmlns:v1="http://www.oracle.com/retail/integration/rib/ApplicationMessages/v1"> <v1:family>WH</v1:family> <v1:type>WHCR</v1:type> <!--Optional:--> <v1:businessObjectId>?</v1:businessObjectId> <!--Zero or more repetitions:--> <v1:ApplicationMessageRoutingInfo> <v1:name>?</v1:name> <v1:value>?</v1:value> <!--Zero or more repetitions:--> <v1:ApplicationMessageRoutingInfoDetail> <v1:name>?</v1:name> <v1:value>?</v1:value> </v1:ApplicationMessageRoutingInfoDetail> </v1:ApplicationMessageRoutingInfo> <v1:payloadXml><WHDesc xmlns="http://www.oracle.com/retail/integration/base/bo/WHDesc/v1"><wh>10</wh><wh_name>g</wh_name></WHDesc></v1:payloadXml> </v1:ApplicationMessage> |
HTTP/1.1 401 WWW-Authenticate: Basic realm="Authentication required" Content-Type: text/html;charset=utf-8 Content-Language: en Content-Length: 669 Date: Thu, 05 Aug 2021 05:08:40 GMT Keep-Alive: timeout=20 Connection: keep-alive <!doctype html><html lang="en"><head><title>HTTP Status 401 â€" Unauthorized</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 401 â€" Unauthorized</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Description</b> The request has not been applied because it lacks valid authentication credentials for the target resource.</p><hr class="line" /><h3>Apache Tomcat/8.5.64</h3></body></html> |
Failure |