Hi,
I am able to insert the data into ap_invoices_interface table using soapui, but when i build webservice proxy in Jdeveloper the data is not getting inserted. This should be pretty straight forward but looks like I am missing some step here. Below is the code please look into it.
public static void main(String[] args) throws Exception{
InvoiceInterfaceServiceSoapHttpPortClient client = new InvoiceInterfaceServiceSoapHttpPortClient();
CreateInvoiceInterfaceResponse hello = new CreateInvoiceInterfaceResponse();
InvoiceInterfaceHeaderResult res = new InvoiceInterfaceHeaderResult();
InterfaceResponseResult res2 = new InterfaceResponseResult();
List<InvoiceInterfaceLine> InvList= new ArrayList<InvoiceInterfaceLine>();
ObjectFactory Hdr= new ObjectFactory();
ObjectFactory line = new ObjectFactory();
InvoiceInterfaceHeader InvHdr = Hdr.createInvoiceInterfaceHeader();
InvoiceInterfaceLine InvLine = line.createInvoiceInterfaceLine();
InvoiceClient ic = new InvoiceClient();
ic.getconnection();
AmountType at=new AmountType();
at.setValue(new BigDecimal("900"));
AmountType UP=new AmountType();
UP.setValue(new BigDecimal("8000"));
MeasureType measureType=new MeasureType();
measureType.setValue(new BigDecimal("1"));
CreateInvoiceInterface create = new CreateInvoiceInterface();
InvHdr.setInvoiceAmount(at);
Long a = new Long("300000069691138");
Long EntityId = new Long("300000001305568");
Long PartyId = new Long("300000069913884");
Long PartySiteId = new Long("300000069932698");
Long TermsId = new Long("10001");
Integer LineNum = new Integer("90");
String sDate1="2017/05/25";
Date date1=new SimpleDateFormat("yyyy/MM/dd").parse(sDate1);
XMLGregorianCalendar date2 = toXMLGregorianCalendar(date1);
QName qName =new QName("http://xmlns.oracle.com/apps/financials/payables/invoices/quickInvoices/invoiceInterfaceService/","InvoiceInterfaceService");
JAXBElement<String>setSource = new JAXBElement<String>(qName,String.class,"ELECTRONIC INVOICE");
JAXBElement<Long>setAcctsPayCodeCombinationId = new JAXBElement<Long>(qName,Long.class,a);
JAXBElement<String>setAttribute1 = new JAXBElement<String>(qName,String.class,"10882632");
JAXBElement<String>setCustomerRegistrationNumber = new JAXBElement<String>(qName,String.class,"67393");
JAXBElement<String>setDescription = new JAXBElement<String>(qName,String.class,"New Header");
JAXBElement<String>setInvoiceCurrencyCode = new JAXBElement<String>(qName,String.class,"USD");
JAXBElement<XMLGregorianCalendar>setGlDate = new JAXBElement<XMLGregorianCalendar>(qName,XMLGregorianCalendar.class,date2);
JAXBElement<XMLGregorianCalendar>setInvoiceDate = new JAXBElement<XMLGregorianCalendar>(qName,XMLGregorianCalendar.class,date2);
JAXBElement<String>setInvoiceTypeLookupCode = new JAXBElement<String>(qName,String.class,"STANDARD");
JAXBElement<Long>setLegalEntityId = new JAXBElement<Long>(qName,Long.class,EntityId);
JAXBElement<XMLGregorianCalendar>setInvoiceReceivedDate = new JAXBElement<XMLGregorianCalendar>(qName,XMLGregorianCalendar.class,date2);
JAXBElement<Long>setPartyId = new JAXBElement<Long>(qName,Long.class,PartyId);
JAXBElement<Long>setPartySiteId = new JAXBElement<Long>(qName,Long.class,PartySiteId);
JAXBElement<String>setPayProcTrxnTypeCode = new JAXBElement<String>(qName,String.class,"PAYABLES_DOC");
JAXBElement<String>setPaymentFunction = new JAXBElement<String>(qName,String.class,"PAYABLES_DISB");
JAXBElement<String>setPaymentMethodCode = new JAXBElement<String>(qName,String.class,"WIRE");
JAXBElement<Long>setTermsId = new JAXBElement<Long>(qName,Long.class,TermsId);
JAXBElement<Integer>setLineNumber = new JAXBElement<Integer>(qName,Integer.class,LineNum);
JAXBElement<String>setAttribute2 = new JAXBElement<String>(qName,String.class,"80");
JAXBElement<String>setAttribute3 = new JAXBElement<String>(qName,String.class,"8");
JAXBElement<String>setDistCode = new JAXBElement<String>(qName,String.class,"01-00-211002-00-0000");
JAXBElement<String>setUnitOfMeasLookupCode = new JAXBElement<String>(qName,String.class,"EACH");
JAXBElement<AmountType> unitPrice= new JAXBElement<AmountType>(qName,AmountType.class,UP);
JAXBElement<MeasureType> InvQty= new JAXBElement<MeasureType>(qName,MeasureType.class,measureType);
InvHdr.setSource(setSource);
InvHdr.setOrgId(new BigDecimal("300000067474625"));
InvHdr.setVendorId(new Long("300000069913887"));
InvHdr.setVendorSiteId(new Long("300000069982722"));
InvHdr.setAcctsPayCodeCombinationId(setAcctsPayCodeCombinationId);
InvHdr.setAttribute1(setAttribute1);
InvHdr.setCustomerRegistrationNumber(setCustomerRegistrationNumber);
InvHdr.setDescription(setDescription);
InvHdr.setInvoiceCurrencyCode(setInvoiceCurrencyCode);
InvHdr.setGlDate(setGlDate);
InvHdr.setInvoiceAmount(at);
InvHdr.setInvoiceDate(setInvoiceDate);
InvHdr.setInvoiceTypeLookupCode(setInvoiceTypeLookupCode);
InvHdr.setLegalEntityId(setLegalEntityId);
InvHdr.setInvoiceNumber("809");
InvHdr.setInvoiceReceivedDate(setInvoiceReceivedDate);
InvHdr.setPartyId(setPartyId);
InvHdr.setPartySiteId(setPartySiteId);
InvHdr.setPayProcTrxnTypeCode(setPayProcTrxnTypeCode);
InvHdr.setPaymentFunction(setPaymentFunction);
InvHdr.setPaymentMethodCode(setPaymentMethodCode);
InvHdr.setTermsId(setTermsId);
InvLine.setAmount(at);
InvLine.setLineNumber(setLineNumber);
InvLine.setLineTypeLookupCode("909");
InvLine.setAttribute1(setAttribute1);
InvLine.setAttribute2(setAttribute2);
InvLine.setAttribute3(setAttribute3);
InvLine.setDistCodeConcatenated(setDistCode);
InvLine.setLineTypeLookupCode("ITEM");
InvLine.setInvoicedQuantity(InvQty);
InvLine.setUnitOfMeasLookupCode(setUnitOfMeasLookupCode);
InvLine.setUnitPrice(unitPrice);
InvList.add(InvLine);
create.setInvoiceInterfaceHeader(InvHdr);
System.out.println("The result is "+ InvLine.getLineTypeLookupCode()+".." +res.getValue()+",,,,"+res2.getValue()+hello.getResult());
}
public static XMLGregorianCalendar toXMLGregorianCalendar(Date date){
GregorianCalendar gCalendar = new GregorianCalendar();
gCalendar.setTime(date);
XMLGregorianCalendar xmlCalendar = null;
try {
xmlCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gCalendar);
} catch (DatatypeConfigurationException ex) {
// Logger.getLogger(StringReplace.class.getName()).log(Level.SEVERE, null, ex);
}
return xmlCalendar;
}
public class InvoiceClient {
private static InvoiceInterfaceService_Service invoiceService_Service;
private InvoiceInterfaceHeader invoice;
private InvoiceInterfaceLine invoiceLine;
public InvoiceInterfaceService getconnection() {
SecurityPolicyFeature[] securityFeatures =
new SecurityPolicyFeature[] { new SecurityPolicyFeature("oracle/wss_username_token_over_ssl_client_policy") };
InvoiceInterfaceService invoiceService=null;
String wsURL = "https://eejl-test.fin.em3.oraclecloud.com:443/finApInvQuickInvoicesModel/InvoiceInterfaceService?WSDL";
String qName = "http://xmlns.oracle.com/apps/financials/payables/invoices/quickInvoices/invoiceInterfaceService/";
try
{
invoiceService_Service = new InvoiceInterfaceService_Service(
new URL(wsURL),
new QName(qName,"InvoiceInterfaceService") );
} catch (MalformedURLException e) {
e.printStackTrace();
}
// customerAccountService_Service = new CustomerAccountService_Service();
try
{
invoiceService = invoiceService_Service.getInvoiceInterfaceServiceSoapHttpPort(securityFeatures);
}
catch (Exception e) {
e.printStackTrace();
}
WSBindingProvider wsbp = (WSBindingProvider)invoiceService;
wsbp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,"abc");
wsbp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,"abc123");
return invoiceService;
}}