1 4 5 package com.sun.j2ee.blueprints.docoriented.client.attachmentposervice; 6 7 import java.rmi.*; 8 import java.io.*; 9 import java.net.*; 10 11 import javax.xml.transform.*; 12 import javax.xml.transform.stream.*; 13 14 import com.sun.j2ee.blueprints.docoriented.client.*; 15 16 20 public class AttachmentPOServiceBD { 21 22 private ServiceLocator serviceLocator; 23 24 public AttachmentPOServiceBD(){ 25 serviceLocator = new ServiceLocator(); 26 } 27 28 public String submitPO(PurchaseOrder po) throws RequestHandlerException { 29 try { 30 AttachmentPurchaseOrderServiceSEI port = (AttachmentPurchaseOrderServiceSEI) 31 serviceLocator.getServicePort(JNDINames.ATTACHMENT_SERVICE_REF, 32 AttachmentPurchaseOrderServiceSEI.class); 33 String xmlDoc = po.toXMLString(); 34 Source src = new StreamSource(new StringReader(xmlDoc)); 35 URI resp= port.submitPO(src); 36 return resp.getSchemeSpecificPart(); 37 } catch(InvalidPOException ipe){ 38 ipe.printStackTrace(System.err); 39 throw new RequestHandlerException("Request Handler Exception: Service Endpoint Application-Defined Exception "+ipe.getMessage(), ipe); 40 } catch(RemoteException re){ 41 re.printStackTrace(System.err); 42 throw new RuntimeException ("The web service you are trying to access is not available. A possible reason could be that the service has not been deployed yet. "+ re.getMessage(), re); 43 } 44 } 45 } 46 47 | Popular Tags |