Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pl.edu.zut.wi.edi.soapws.client;
- import static java.lang.System.out;
- import java.io.IOException;
- import javax.xml.parsers.ParserConfigurationException;
- import javax.xml.transform.TransformerException;
- import org.xml.sax.SAXException;
- /**
- *
- * wsimport -p pl.edu.zut.wi.edi.soapws.client -keep http://localhost:8888/wus?wsdl
- *
- */
- public class WUClient {
- WUServiceImplService service = new WUServiceImplService( );
- WUService port = service.getWUServiceImplPort( );
- public static void main( String[ ] args ) {
- WUClient wuc = new WUClient( );
- try {
- wuc.start2( );
- } catch( Exception ex ) {
- ex.printStackTrace( );
- }
- }
- private void start1( ) throws SAXException, ParserConfigurationException, IOException, TransformerException {
- /* wczytaj i waliduj dokument XML */
- WUXMLBuilder wuxmlb = new WUXMLBuilder( );
- wuxmlb.validateXML( "PIT37.xml" );
- out.println( "[INFO] Dokument XML jest zgodny ze schematem XSD:" );
- out.println( new String( wuxmlb.getDocumentBytes( ) ) );
- /* wysłanie dokumentu XML */
- out.println( "\n[INFO] Wysyłam dokument XML do WUService." );
- String secret = port.send( wuxmlb.getDocumentBytes( ) );
- out.println( "[INFO] Secret = {" + secret + "}" );
- /* pobierz status przetwarzania dokumentu */
- out.println( "\n[INFO] Pobieram status dokumentu XML secret = {" + secret + "}" );
- int status = port.status( secret );
- out.println( "[INFO] Odebrałem Status = {" + status + "}" );
- }
- private void start2( ) throws SAXException, ParserConfigurationException, IOException, TransformerException {
- /* wczytaj i waliduj dokument XML */
- WUXMLBuilder wuxmlb = new WUXMLBuilder( );
- wuxmlb.validateXML( "PIT37.xml" );
- out.println( "[INFO] Dokument XML jest zgodny ze schematem XSD:" );
- out.println( wuxmlb.getDocumentString( ) );
- /* wysłanie dokumentu XML */
- out.println( "\n[INFO] Wysyłam dokument XML do WUService." );
- String secret = port.send( wuxmlb.getDocumentBytes( ) );
- out.println( "[INFO] Secret = {" + secret + "}" );
- /* pobierz status przetwarzania dokumentu */
- out.println( "\n[INFO] Pobieram status dokumentu XML secret = {" + secret + "}" );
- int status = port.status( secret );
- out.println( "[INFO] Odebrałem Status = {" + status + "}" );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement