0% found this document useful (0 votes)
241 views2 pages

Private Void jButton1ActionPerformed

This Java code calls a web service operation to process a purchase order. It initializes arguments like the customer details, credit card, items, and order date. These are set on a PurchaseOrderType object which is passed to the web service operation. Based on the result, the status is updated to indicate if the operation was successful or if an error occurred.

Uploaded by

Ashyou Youash
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
241 views2 pages

Private Void jButton1ActionPerformed

This Java code calls a web service operation to process a purchase order. It initializes arguments like the customer details, credit card, items, and order date. These are set on a PurchaseOrderType object which is passed to the web service operation. Based on the result, the status is updated to indicate if the operation was successful or if an error occurred.

Uploaded by

Ashyou Youash
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { try { // Call Web Service Operation State.setBackground(Color.YELLOW); State.

setText("please wait, your request under processing"); org.netbeans.j2ee.wsdl.pobpel.po.POService service = new org.netbeans.j2ee.wsdl.pobpel.po.POService(); org.netbeans.j2ee.wsdl.pobpel.po.POPortType port = service.getPOPort(); // TODO initialize WS operation arguments here org.netbeans.xml.examples.purchaseorder.PurchaseOrderType part1 = new org.netbeans.xml.examples.purchaseorder.PurchaseOrderType(); Customer cus=new Customer(); cus.setName(CustomerName.getText()); cus.setContry(CustomerCountry.getSelectedItem().toString()); cus.setCity(CustomerCity.getSelectedItem().toString()); CreditCard cc=new CreditCard(); cc.setCardNo(CardNumber.getText()); //cc.setCardDate(new XMLGregorianCalendarImpl(new GregorianCalendar(2009, 10, 22))); //GregorianCalendar cal=new GregorianCalendar(); //cal.setTime(parseDate(CardDate.getText())); cc.setCardDate(new XMLGregorianCalendarImpl(new GregorianCalendar())); Items its=new Items(); if(!jQuantity.getText().equals("0")){ Item it = new Item(); it.setProductName(jProductName.getSelectedItem().toString()); it.setQuantity(Integer.parseInt(jQuantity.getText())); it.setPrice(BigDecimal.valueOf(Double.parseDouble(jUnitPrice.getText()))); its.getItem().add(it); } if(!jQuantity1.getText().equals("0")){ Item it = new Item(); it.setProductName(jProductName1.getSelectedItem().toString()); it.setQuantity(Integer.parseInt(jQuantity1.getText()));

it.setPrice(BigDecimal.valueOf(Double.parseDouble(jUnitPrice1.getText()))); its.getItem().add(it); } if(!jQuantity2.getText().equals("0")){ Item it = new Item(); it.setProductName(jProductName2.getSelectedItem().toString()); it.setQuantity(Integer.parseInt(jQuantity2.getText())); it.setPrice(BigDecimal.valueOf(Double.parseDouble(jUnitPrice2.getText()))); its.getItem().add(it); } cc.setCustomer(cus); part1.setCreditCard(cc); part1.setItems(its); part1.setOrderDate(new XMLGregorianCalendarImpl(new GregorianCalendar())); // TODO process result here System.out.println("asd "+part1.getItems().getItem().size()); org.netbeans.xml.examples.purchaseorder.InvoiceType result = port.poOperation(part1); State.setBackground(Color.GREEN); State.setText("done witout any problem"); Total.setText(result.getTotal().toString()); Shipment.setText(result.getShipment().getCompanyName()); } catch (POOperationFault ex) { State.setBackground(Color.RED); State.setText("ERROR: "+ex.getFaultInfo()); } catch (Exception ex){ State.setBackground(Color.RED); State.setText("please insert an validate order"); ex.printStackTrace(); }

You might also like