E-invoice manual Instruction for a client implementation of the B2B web service

Similar documents
SDK Code Examples Version 2.4.2

bbc Developing Service Providers Adobe Flash Media Rights Management Server November 2008 Version 1.5

Implementing a Web Service Client using Java

e-filing Secure Web Service User Manual

JobScheduler Web Services Executing JobScheduler commands

Application Notes for Packaging and Deploying Avaya Communications Process Manager Sample SDK Web Application on a JBoss Application Server Issue 1.

Capture 8. Import Connector - Web Services SDK Developer s Guide Rev A

IBM SPSS Collaboration and Deployment Services Version 6 Release 0. Single Sign-On Services Developer's Guide

EMC Clinical Archiving

Java Access to Oracle CRM On Demand. By: Joerg Wallmueller Melbourne, Australia

Author: Gennaro Frazzingaro Universidad Rey Juan Carlos campus de Mostòles (Madrid) GIA Grupo de Inteligencia Artificial

StreamServe Persuasion SP4 Service Broker

PHP Integration Kit. Version User Guide

Onset Computer Corporation

UFTP AUTHENTICATION SERVICE

Tridion R5. Business Connector Guide 5.2 SP1

DEVELOPING CONTRACT - DRIVEN WEB SERVICES USING JDEVELOPER. The purpose of this tutorial is to develop a java web service using a top-down approach.

Creating Form Rendering ASP.NET Applications

Authoring for System Center 2012 Operations Manager

Securing Web Services Using Microsoft Web Services Enhancements 1.0. Petr PALAS PortSight Software Architect

Java Web Services SDK

Using mobile phones to access Web Services in a secure way. Dan Marinescu

CS506 Web Design and Development Solved Online Quiz No. 01

a) Install the SDK into a directory of your choice (/opt/java/jdk1.5.0_11, /opt/java/jdk1.6.0_02, or YOUR_JAVA_HOME_DIR)

Stateful Web Services Practical

Configuring the LCDS Load Test Tool

This guide consists of the following two chapters and an appendix. Chapter 1 Installing ETERNUSmgr This chapter describes how to install ETERNUSmgr.

SAML v1.1 for.net Developer Guide

How to consume a Domino Web Services from Visual Studio under Security

Deploying Microsoft Operations Manager with the BIG-IP system and icontrol

Address Phone & Fax Internet

Mutual Fund Web Service Developer Guide

WEB SERVICES. Revised 9/29/2015

Brekeke PBX Web Service

Web Services Platform Guide

Developer s Setup Guide VMware vsphere Web Services SDK 4.1

Using the Adobe Access Server for Protected Streaming

Module 13 Implementing Java EE Web Services with JAX-WS

Builder User Guide. Version 5.4. Visual Rules Suite - Builder. Bosch Software Innovations

Overview of Web Services API

Installing the ASP.NET VETtrak APIs onto IIS 5 or 6

Developing Java Web Services

Developing Web Services with Eclipse and Open Source. Claire Rogers Developer Resources and Partner Enablement, HP February, 2004

EJB 3.0 and IIOP.NET. Table of contents. Stefan Jäger / stefanjaeger@bluewin.ch

Integration of Hotel Property Management Systems (HPMS) with Global Internet Reservation Systems

Web Service Development Using CXF. - Praveen Kumar Jayaram

WebService Security. A guide to set up highly secured client-server communications using WS-Security extensions to the SOAP protocol

RPC over XML. Web services with Java. How to install it? Reference implementation. Setting the environment variables. Preparing the system

TARGETPROCESS WEB SERVICES GUIDE

SETTING UP YOUR JAVA DEVELOPER ENVIRONMENT

Builder User Guide. Version Visual Rules Suite - Builder. Bosch Software Innovations

17 March 2013 NIEM Web Services API Version 1.0 URI:

fåíéêåéí=péêîéê=^çãáåáëíê~íçêûë=dìáçé

JBoss SOAP Web Services User Guide. Version: M5

Integrating Siebel CRM with Microsoft SharePoint Server

Force.com Migration Tool Guide

Getting started with OWASP WebGoat 4.0 and SOAPUI.

Oracle Forms Services Secure Web.Show_Document() calls to Oracle Reports

XMLVend Protocol Message Validation Suite

Using Actian PSQL as a Data Store with VMware vfabric SQLFire. Actian PSQL White Paper May 2013

ResPAK Internet Module

MS Enterprise Library 5.0 (Logging Application Block)

InternetVista Web scenario documentation

ZeroTurnaround License Server User Manual 1.4.0

Web Services Development Kit

T320 E-business technologies: foundations and practice

European Access Point for Truck Parking Data

How To Use Blackberry Web Services On A Blackberry Device

IBM WebSphere Message Broker - Integrating Tivoli Federated Identity Manager

Java Web Services Developer Pack. Copyright 2003 David A. Wilson. All rights reserved.

KC Data Integration Web Service Developer Guide

Creating SOAP and REST Services and Web Clients with Ensemble

How To Write A File Station In Android.Com (For Free) On A Microsoft Macbook Or Ipad (For A Limited Time) On An Ubuntu 8.1 (For Ubuntu) On Your Computer Or Ipa (For

AXIS 70U - Using Scan-to-File

A Java proxy for MS SQL Server Reporting Services

Web Services using Tomcat and Eclipse

CA Nimsoft Service Desk

Connecting Custom Services to the YAWL Engine. Beta 7 Release

StreamServe Persuasion SP5 StreamStudio

Web Services API Developer Guide

WIRIS quizzes web services Getting started with PHP and Java

Microsoft Corporation. Project Server 2010 Installation Guide

CLC Server Command Line Tools USER MANUAL

TIBCO Loyalty Lab Reward API Reference

Sophos Mobile Control Web service guide

Brekeke PBX Version 3 Web Service Developer s Guide Brekeke Software, Inc.

Oracle WebLogic Server

Getting Started with the Internet Communications Engine

The MoCA CIS LIS WSDL Network SOAP/WS

Sentinel EMS v7.1 Web Services Guide

Copyright 2013 Consona Corporation. All rights reserved

Introduction Installing the download utility Installing Java(TM) 2 Runtime Environment, Standard Edition

Using EMC Documentum with Adobe LiveCycle ES

Consuming, Providing & Publishing WS

JAVA API FOR XML WEB SERVICES (JAX-WS)

Transcription:

E-invoice manual Instruction for a client implementation of the B2B web service 460.109 en (doc.pf) 08.2013 PF Manual Instruction for a client implementation of the B2B web service Version August 2013 1/20

E-invoice Customer Service PostFinance Ltd Mingerstrasse 20 3030 Berne www.postfinance.ch/e-bill Consulting and Sales business customers Phone +41 0848 848 848 (from a landline CHF 0.08/min) Integration and Support Helpdesk E-Invoice supported by Swiss Post Solutions AG Phone +41 0800 111 101 (standard rate) E-mail e-bill.help@postfinance.ch Manual Instruction for a client implementation of the B2B web service Version August 2013 2/20

Contents 1. Introduction 4 2. Background 5 2.1 Preparation for implementation in C# 5 2.2 Preparation for implementation in Java 5 3. Specification 6 3.1 Web service for biller 6 3.1.1 Upload Services 6 3.1.1.1 UploadFiles 6 3.1.1.2 UploadFilesReport 7 3.1.2 Download Services 7 3.1.2.1 GetInvoiceListWithIDs 7 3.1.2.2 GetInvoiceByID 8 3.1.2.3 GetProcessProtocol 8 3.1.2.4 GetRegistrationList 9 3.1.2.5 GetRegistration 9 3.2 Web service for payer 9 3.2.1.1 GetInvoiceListWithIDs 10 3.2.1.2 GetInvoiceByID 10 4. Implementation 11 4.1 Interfaces 11 4.2 Implementation in C# 11 4.3 Implementation in Java 14 5. Final comments 19 6. Annex A 20 6.1 Links relating to the integration 20 6.2 Links relating to production 20 Manual Instruction for a client implementation of the B2B web service Version August 2013 3/20

1. Introduction Within the e-bill project with PostFinance there is a requirement to allow bills to be uploaded and downloaded through an automated interface to/ from the yellowbill system. The decision was to use SOAP web services for this purpose. For security reasons the web services must be implemented on the basis of WS-Security. This document serves as a brief instruction guide for a client implementation of the web services in the programming languages C# 1.1 (WSE2.0) and Java (JWSDP 1.5). Knowledge of the mentioned programming languages, the SOAP web services and the WS-Security specification is a requirement and those are therefore not further discussed in this document. Manual Instruction for a client implementation of the B2B web service Version August 2013 4/20

2. Background You are a biller or a payer and wish to use the bill upload or download web services provided by PostFinance. You can implement your client in any programming language you wish as long as the XML requests correspond to the SOAP specifications with the WS-Security extension. Because those XMLs are fairly comprehensive there are a variety of frameworks that simplify implementation of the web services considerably. You therefore do not have to create the SOAP XML "by hand". This document describes the client implementation of the yellowbill web services in C# and Java. 2.1 Preparation for implementation in C# In order to implement the client with Microsoft.NET, the.net SDK 1.1 or.net SDK 2.0 framework must be installed. It can be downloaded free of charge from http://msdn2.microsoft.com/en-us/netframework/ default.aspx. The WS-Security extensions which are part of Microsoft's WSE 2.0 for.net 1.1 or WSE 3.0 for.net 2.0 (Web Services Enhancements) are also required. This package can also be downloaded free of charge at this link http://msdn2.microsoft.com/en-us/webservices/default.aspx. The presence of Microsoft s Visual Studio 2003 or Visual Studio 2005 is an advantage but not a requirement. The SDK.NET framework provides all the necessary tools, e.g. compiler, generation of the proxy classes from the wsdl file, etc. Install the framework first and then WSE 2.0 respectively WSE 3.0. 2.2 Preparation for implementation in Java If the client application has to be implemented in Java, you will require Java 2 Platform Standard Edition (J2SE), version 1.4.2 or higher. Sun provides it free of charge at http://java.sun.com/j2se/index.jsp. An extension for the web service functionality is also required for Java. This package is called Java Web Services Developer Pack (Java WSDP) and can also be downloaded free of charge. Version 1.5 is required: http://java.sun.com/webservices/jwsdp/index.jsp. Now you have all the necessary tools to create proxy classes, compiling, etc. Install J2SE first and then JWSDP. There are several other Java frameworks to implement web services (with the WS-Security extension), e.g. using Apache Axis or webmethods GLUE, etc. You are free to use any existing frameworks provided that they conform to the specifications. Manual Instruction for a client implementation of the B2B web service Version August 2013 5/20

3. Specification The advantage of web services is that we will not have to worry about communications or the protocol on the client side or the server side. The various frameworks usually do this work for you. Thanks to the generated proxy classes the client can call up functionalities as if they were local classes. An explanation of the yellowbill web service functionalities follows. 3.1 Web service for biller 3.1.1 Upload Services The UploadInvoice web service is intended for billers and provides methods for uploading bill files. The following listed bill types are supported. The File- Type determinate the file extension of the uploaded file. This is important for further processing. Bill Types PDF bill detail for presentment ybinvoice or CreateBill format Custom XML bill format like SAPiDoc FileType (File Extension) "PDF" "XML" "EAI.XML" Custom EDIFACT bill format "EAI.EDI" 3.1.1.1 UploadFiles The interface of the UploadFiles method is as follows: NotProcessedInvoice[] UploadFiles( Invoice[] invoices, String BillerID ); The method expects an array of type Invoice (see below) and the BillerID of the biller to be passed. It returns an array of the type NotProcessedInvoice (see below). To avoiding timeout and peformance problems while uploading a greater amount of Invoices, we recommend to call the UploadFiles Methode for each Invoice rather than to upload them all together with one single call. The type Invoice is a self-declared data type representing a file. It is defined as follows: public class Invoice public String FileType; public String TransactionID; public byte[] Data; The TransactionID is the biller s bill identification and must be identical to the one in the bill file. The Data field contains the file contents in the form of a binary stream. A byte array, however, cannot be simply transferred via http. The binary stream must be converted into a base64-encoded string and then converted back again on the other side. This conversion, however, Manual Instruction for a client implementation of the B2B web service Version August 2013 6/20

is usually done automatically by the SOAP framework. The NotProcessedInvoice data type has the following structure: public class NotProcessedInvoice public String FileType; public String TransactionID; A NotProcessedInvoice entry indicates that the file could not be uploaded. The biller can tell which invoice is concerned by checking the TransactionID. The biller receives more detailed information in a separate processing log delivered daily. To comply with the WS-Security specification, requests always have a username token and a timeout. Further details below. 3.1.1.2 UploadFilesReport The request for UploadFilesReport is similar to the method above. But in the response more detailed information about the transmission status of the files is given. The result is returned in the form of an array of type ProcessedInvoice with the following structure. public class ProcessedInvoice public String FileType; public DateTime SubmitDate; public String TransactionID; public String ProcessingState; This type of report entry corresponds to a daily report for each file type. The FileType may be one of the list above. The SubmitDate are date and time of the request and the TransactionID is the unique invoice ID supplied by the biller at upload. Processing contains the state of the submitted data. They may be "OK" or "NOK" by uploaded data. This information may be used for the download methods. 3.1.2 Download Services The Download web service provides the biller with eight bill management methods. A distinction is made between outstanding bills, protocols and registrations (never downloaded) and archived data (already downloaded). It can be controlled by ArchiveData (true / false). Data already collected remain available for 40 days after the first download. 3.1.2.1 GetInvoiceListWithIDs This method returns a report list of available bills with the most important details. It replaces the omitted method GetInvoiceList. The interfaces are as follows: InvoiceReportWithID[] GetInvoiceList( String BillerID, bool ArchiveData ); Manual Instruction for a client implementation of the B2B web service Version August 2013 7/20

The method expect the BillerID and the ArchiveData flag as parameters to be passed. To list already downloaded bills, the ArchiveData flag must be set to true. The result will be returned in an array of type InvoiceReportWithID with the following structure. public class InvoiceReportWithID public String BillerID; public String TransactionID; public DateTime DeliveryDate; public String FileType; This type of report contains the follwing details for each bill. The TransactionID is the unique invoice ID and the DeliveryDate is the invoice date supplied by the biller when uploading it. The FileType may be "RGXMLSIG" or "EDIFACT". Bills which are embedded as an appendix in a ybinvoice like the SAPiDoc are also of the FileType "RGXMLSIG". All this information may be used for the download methods. 3.1.2.2 GetInvoiceByID This method allows to download a single signed invoice by its TransactionID. It replaces the omitted method GetInvoce. For obtaining the TransactionID, the GetInvoiceListWithID method has to be called first. DownloadFile GetInvoiceByID( String BillerID, string TransactionID ); The BillerID and the TransactionID are expected as parameters to be passed. The downloaded file is returned in a structure of the type DownloadFile. public class DownloadFile public byte[] Data; public String Filename; It contains the Filename and the content in the form of a binary stream (Data). Now you can save it into a file. Any further processing of the invoice is in the responsibility of the biller. 3.1.2.3 GetProcessProtocol This method allow ProcessProtocols to be downloaded. DownloadFile[] GetProcessProtocol( String BillerID, DateTime CreateDate, boolean ArchiveData ); Each downloaded file is returned in a structure of the type DownloadFile. public class DownloadFile public byte[] Data; public String Filename; Manual Instruction for a client implementation of the B2B web service Version August 2013 8/20

It contains the Filename and the contents in the form of a binary stream (Data). You now save it into a file. Any further processing of the Process Protocol is the biller s responsibility. Aditionnal explication for the Process Protocol is available in the e-bill manual. 3.1.2.4 GetRegistrationList This method returns a list of available downloads with the most important details. The interfaces are as follows: Report[] GetRegistrationList( String BillerID, boolean ArchiveData ); They expect the BillerID parameter to be passed. The result is returned in the form of an array of type ProtocolReport with the following structure. public class ProtocolReport public DateTime CreateDate; public String FileType; This type of report entry corresponds to a daily report for each file type. The CreateDate is the date of the creation by yellowbill system. The FileType is "R". 3.1.2.5 GetRegistration This method allow registrations to be downloaded. DownloadFile[] GetRegistration( String BillerID, DateTime CreateDate, boolean ArchiveData ); Each downloaded file is returned in a structure of the type DownloadFile. public class DownloadFile public byte[] Data; public String Filename; It contains the Filename and the contents in the form of a binary stream (Data). You now save it into a file. Any further processing of the registrations is the biller s responsibility. Aditionnal explication for the registration information is available in the e-bill manual. 3.2 Web service for payer 3.2.1 Download Services The DownloadInvoice web service provides the payer with eight bill management methods. A distinction is made between outstanding bills (never downloaded and thus not yet paid) and archived bills (already downloaded). Bills already collected remain available in the archive for 40 days after the first download. The bills that can be collected are digitally signed XMLs. Manual Instruction for a client implementation of the B2B web service Version August 2013 9/20

3.2.1.1 GetInvoiceListWithIDs This method returns a report list of available bills with the most important details. It replace the omitted methods GetOpenList and GetArchiveList. The interfaces are as follows: InvoiceReportWithID[] GetInvoiceListWithIDs ( String ebillaccountid, bool ArchiveData ); The method expects the ebillaccountid and the ArchiveData flag parameters to be passed. For listing already downloaded bills, the Archive- Data flag must be set to true. The result is returned as an array of type InvoiceReportWithID with the following structure. public class InvoiceReportWithID public String BillerID; public String TransactionID; public DateTime DeliveryDate; public String FileType; This type of report contains the follwing details for each bill. The BillerID is the Biller s Identification. The TransactionID is the unique invoice ID and the DeliveryDate is the invoice date supplied by the biller when uploading it. The FileType may be "PDF", "RGXMLSIG", "EDIFACT" or ZIP (Delivery- Container). Bills which are embedded as an appendix in a ybinvoice like the SAPiDoc are also of the FileType "RGXMLSIG". All this information may be used for the download methods. 3.2.1.2 GetInvoiceByID This method allows to download a single signed invoice or a PDF billdetail by its TransactionID. It replaces the omitted method GetInvoces, GetInvoices- Archive, GetPDF and GetPDFArchive. For obtaining the BilerID and TransactionID, the GetInvoiceListWithID method has to be called first. DownloadFile GetInvoiceByID( string ebillaccountid, string BillerID, string TransactionID, string FileType ); The ebillaccountid, BillerID, TransactionID and FileType are expected as parameters to be passed. The downloaded file is returned in a structure of the type DownloadFile. public class DownloadFile public byte[] Data; public String Filename; It contains the Filename and the content in the form of a binary stream (Data). Now you can save it into a file. Any further processing of the invoice is the responsibility of the payer. Manual Instruction for a client implementation of the B2B web service Version August 2013 10/20

4. Implementation This section serves as a short tutorial on the implementation of the web service clients. The programming languages C# and Java will be addressed. For Java there are of course numerous frameworks for implementing SOAP web services. Only JWSDP will be addressed here. 4.1 Interfaces The interface of a SOAP web service is described by the WSDL file (Web Service Description Language) which is published by the web service and describes the methods that can be called up by the client. This file serves as a basis so that the various frameworks can generate the necessary proxy classes. Please note that no information concerning the implemented WS-Security recommendations can be read from the WSDL file. The WSDL file for the biller upload web service is available at the following URL: https://ebill-ki.postfinance.ch/b2bwebservices/uploadinvoice.asmx?wsdl The interface description for the biller download web service is at the following link: https://ebill-ki.postfinance.ch/b2bwebservices/billerdownloadservices.asmx?wsdl The interface description for the payer download web service is at the following link: https://ebill-ki.postfinance.ch/b2bwebservices/downloadinvoice.asmx?wsdl 4.2 Implementation in C# It is presumed that the preparations in section 2.1 have already been carried out. The first step is to generate the proxy classes. If you are working with Visual Studio.NET you can open a new or existing project. Then select "Add Web Reference" to add a web reference to the project. Enter the URL of the WSDL file in the window that now appears. Next, you can change the namespace, if necessary. The generated class is located in the Reference.cs file. In this case, minor adjustments have to be made to this file. We therefore recommend that you copy the contents of Reference.cs and paste them into a new file, e.g. UploadInvoice Proxy.cs. The new file can, for example, be stored in the project root folder. Because WSE 2.0 is being used, the class declaration needs to be changed: After generation it reads: public class UploadInvoice : System.Web.Services.Protocols.SoapHttpClientProtocol Edit it to read as follows: public class UploadInvoice : Microsoft.Web.Services2.WebServicesClientProtocol The reference to Microsoft.Web.Services2.dll also needs to be added to the project. The WebReferences directory can then be deleted provided that no other web services are linked in. Manual Instruction for a client implementation of the B2B web service Version August 2013 11/20

The reference to Microsoft.Web.Services2.dll also needs to be added to the project. The WebReferences directory can then be deleted provided that no other web services are linked in. The functionality of the new class can now be used just like an ordinary C# class. You can also create the proxy class with the wsdl command line tool. For our example the command syntax could be as follows: wsdl /n:b2bwebservices /o:uploadinvoiceproxy.cs /protocol:soap /l:cs https://ebill-ki.postfinance.ch/b2bwebservices/uploadinvoice.asmx?wsdl In this case as well, the class has to be adjusted as above. Now for the implementation itself. Here we will only show the example of the biller, i.e. the upload client. The bill issuer must have a valid username and password. If possible these should be stored in a separate file or database and must on no account be accessible to unauthorized persons. First there is an initialization block in which the username, password and BillerID are read in. How you read them in is up to you. Invoice[] invoices = new Invoice[txtFilenames.Lines.Length]; NotProcessedInvoice[] npinvoices = null; String Username = ; String Password = ; String BillerID = ; Next, the invoices array is filled with the FileType, TransactionID and Data of each file. This should present no problems. The WS-Security specification defines a username token which can be used for authenticating web services (for further information refer to http://www.oasis-open.org/committees/download.php/16782/wss-v1.1- spec-os UsernameTokenProfile.pdf). Because the web service is located behind a proxy, a redirection URL and a destination URL have to be specified when initializing the proxy class. UploadServiceDestination: https://ebill-ki.postfinance.ch/b2bwebservices/uploadinvoice.asmx Manual Instruction for a client implementation of the B2B web service Version August 2013 12/20

UsernameToken token = new UsernameToken( Username, Password, PasswordOption.SendPlainText ); UploadInvoiceProxy.UploadInvoiceProxy uploadproxy = new UploadInvoiceProxy.UploadInvoiceProxy(); Microsoft.Web.Services2.Addressing.EndpointReference epr = new Microsoft.Web.Services2.Addressing.Endpoint Reference(new Uri(ConfigurationSettings.AppSettings["Upload ServiceDestination"])); epr.via = new Uri(ConfigurationSettings.AppSettings "UploadServiceVia"]); uploadproxy.destination = epr; uploadproxy.requestsoapcontext.security.tokens.add ( token ); For stronger authentication security it s fairly recommended to use additionally to the username token, the binary security token (for further information refer to http://www.oasis-open.org/committees/download.php/16785/wss-v1.1- spec-os-x509tokenprofile.pdf). To use a binary security token, a client certificate is required. The following example shows how to implement a binary security token in a webservice client. // create SecurityToken X509SecurityToken x509token = new X509SecurityToken (x509certificate); // add SecurityToken uploadproxy.requestsoapcontext.security.tokensadd (x509token); // sign the message uploadproxy.requestsoapcontext.security.elements. Add(new MessageSignature(x509Token)); For a further level of security, WS-Security defines a timestamp (http://www.oasis-open.org/committees/download.php/16790/wss-v1.1- spec-os-soapmessagesecurity.pdf) with which you can ensure that the request is only valid for a certain time period. uploadproxy.requestsoapcontext.security.timestamp. TtlInSeconds = 60; Now comes the actual web service call. npinvoices = uploadproxy.uploadfiles(invoices, BillerID); The client must have the time zone set to GMT +1 and the time difference between client and server may not exceed more than 1 minute. Manual Instruction for a client implementation of the B2B web service Version August 2013 13/20

Finally, a simple evaluation of the returned value is performed. StringBuilder sb = new StringBuilder(); if (npinvoices!= null && npinvoices.length > 0) sb.append("nicht eingelieferte Files!\r\n"); sb.append("**************************\r\n\r\n"); for (int i=0; i<npinvoices.length; i++) sb.append(npinvoices[i].transactionid + "\t" + npinvoices[i].filetype +"\r\n"); txtresult.text = sb.tostring(); else txtresult.text = "Alle Files eingeliefert"; 4.3 Implementation in Java As already mentioned, we will discuss only the JWSDP 1.5 framework. The preparations described in section 2.2 must have been completed. Here, too, the first step is to generate the proxy classes. The Sun documentation is usually based on the assumption that one wants to publish a web service and therefore they require the installation of a web container such as Tomcat. In our case, we really only need the client and there is thus no need for an application server or web container. The generation of client proxy classes using WS-Security extensions is not well documented. Therefore, we recommend that you take the enclosed configuration files and edit them. First of all, the webserviceclient.props file has to be edited. Values must be assigned to all parameters except the proxy information. The meanings of the individual parameters can be taken from the comments in Fig 1. Manual Instruction for a client implementation of the B2B web service Version August 2013 14/20

# place where Java is installed javahome=c:/java/2sdk1.4.2_07 # place where JWSDP is installed jwsdp.home=c:/java/jwsdp-1.5 # Destination of the generated classes build.dir=build # Destination of generated jar File dist.dir=dist # Location of the Configuration-File configfile=config/client-config.xml # Proxy Server Host if there is one proxy.host= # Proxy Server Port if there is a Proxy Server proxy.port= # Name of the jar File jarname=downloadinvoiceproxy # Set to true or false to control jaxrpc tool output jaxrpc.tool.verbose=true Fig 1: Contents of the webserviceclient.props file The webserviceclient.xml file is a control file for the ant tool which is included in the JWSDP package. It is located in <JWSDP-HOME>\apache-ant\ bin. The XML file references the configuration above, assembles the class path, contains compiler instructions for generating classes and much more. In our case, nothing has to be changed in this file. We still recommend, however, that you have a look at it in order to understand the procedure. Next, the client-config.xml file has to be edited. Here you have to enter the URL of the WSDL file and the name of the package to be generated. <?xml version="1.0"?> <!-- This file is used to point to the wsdl location and also to specify the package name you want to use for the generated source --> <configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config"> <wsdl location="http s://ebill-ki.postfinance.c h/b2bwebservices/ DownloadInvoice.asmx?WSDL" packagename="yellowworld.downloadinvoiceproxy"/> Fig 2: Contents of the client-config.xml file Manual Instruction for a client implementation of the B2B web service Version August 2013 15/20

There is another configuration file called user-pass-authenticate-client.xml. This file contains all the information necessary to ensure that the WS-Security extensions are included when generating the proxy classes. <!-- Copyright 2004 Sun Microsystems, Inc. All rights reserved. SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. --> <xwss:jaxrpcsecurity xmlns:xwss="http://java.sun.com/xml/ns/xwss/config"> <xwss:service> <xwss:securityconfiguration dumpmessages="false"> <xwss:timestamp timeout="60"/> <xwss:usernametoken digestpassword="false"/> </xwss:securityconfiguration> </xwss:service> <xwss:securityenvironmenthandler> Yellowworld.WSSecurirty.ClientSecurityEnvironmentHandler </xwss:securityenvironmenthandler> Fig 3: Contents of user-pass-authenticate-client.xml This configuration file defines that the SOAP request must contain a username token and a timestamp (as per WS-Security specification http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-tokenprofile-1.0.pdf and http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-messagesecurity-1.0.pdf The framework automatically inserts this XML node at runtime. You do not have to do this. The only thing you may have to change here is the class name of the callback handler. In our case this is the ClientSecurityEnvironmentHandler. In this class you can define how you wish to read in the username and password, e.g. from a file, from a database, etc. Once you have made all the necessary changes, you can start generating the proxy classes with the ant tool. To do this, enter the following command on the command line: ant f webserviceclient.xml The procedure is logged in the cmd window and takes a few seconds. The generated source files, the compiled classes and the complete jar are now available in the Build directory. The jar file must be now be referenced when implementing the client program on the classpath. A whole lot of jar files have to be included in the class path in order to be able to compile and execute the client program. These are listed below. Manual Instruction for a client implementation of the B2B web service Version August 2013 16/20

<JWSDP_HOME> jwsdp-shared jaxp jaxrpc saaj xws-security lib lib lib lib lib activation.jar jax-qname.jar mail.jar endorsed jaxp-api.jar jaxrpc-impl.jar jaxrpc-spi.jar jaxrpc-api.jar saaj-impl.jar saaj-api.jar dom.jar xercesimpl.jar xalan.jar security-plugin.jar soapprocessor.jar xmlsec.jar xws-security_jaxrpc.jar xws-security.jar Now for the implementation of the client. Our example here will show the retrieval of the list of open bills, i.e. the biller s view. This person must have a valid username and password. If possible, these should be stored in a separate file or database and must on no account be accessible to unauthorized persons. First, there is an initialization block. In this example, the URLs of the web service and the ebillaccountid are stored in a properties file and read in via a property object. However, you can decide about this yourself. The important thing is to initialize the stub class and set the ENDPOINT_ADDRESS_PROPERTY. String serviceurl = papplication.getproperty ("ServiceUrl"); DownloadInvoiceSoap_Stub stub = (DownloadInvoiceSoap_Stub)(dwnlService.getDownload InvoiceSoap()); stub._setproperty(javax.xml.rpc.stub.endpoint_address_ PROPERTY, serviceurl); String ebillaccountid = papplication-getproperty ("ebillaccountid"); Next, you can already call up the method itself, because the proxy classes add the WS-Security extensions here (see Fig 3). ArrayOfReport report = stub.getopenlist(ebillaccountid); Manual Instruction for a client implementation of the B2B web service Version August 2013 17/20

Next, there is a simple evaluation of the returned value. We recommend that you save these returned values so that the actual XML or PDF files can be retrieved. Report[] arrreport = report.getreport(); System.out.println("*** Open List ***"); System.out.println(); if (arrreport.length > 0) for (int i=0; i<arrreport.length; i++) System.out.println(arrReport[i].getDeliveryDate(). gettime().tolocalestring() + "\t" + arrreport[i].getcount() + "\t" + arrreport[i].getfiletype()); else System.out.println("No files available!"); All that needs to be done now is to assign the username / password to the username token. As already mentioned when discussing proxy generation, you have to implement a callback handler class for this. public class ClientSecurityEnvironmentHandler implements CallbackHandler private UnsupportedCallbackException unsupported = new UnsupportedCallbackException(null, "Unsupported Callback Type Encountered"); private String username = ""; private String password = ""; public void handle(callback[] callbacks) throws IOException, UnsupportedCallbackException for (int i=0; i < callbacks.length; i++) if (callbacks[i] instanceof UsernameCallback) UsernameCallback cb = (UsernameCallback)callbacks[i]; username =...; cb.setusername(username); else if (callbacks[i] instanceof PasswordCallback) PasswordCallback cb = (PasswordCallback)callbacks[i]; password =...; cb.setpassword(password); Manual Instruction for a client implementation of the B2B web service Version August 2013 18/20

5. Final comments This document has shown a simple reference implementation for the use of the web services in the environment of the yellowbill system. For the sake of brevity, the details of SOAP, WS-Security,.NET, C#, Java, etc were deliberately omitted. The web service links provided in the document refer to our customer integration platform on which new customer connections are usually tested when they are set up. Due to possible maintenance windows, we cannot guarantee 100% availability of the customer integration platform. The links are listed once more in the Annex. Manual Instruction for a client implementation of the B2B web service Version August 2013 19/20

6. Annex A 6.1 Links relating to the integration Biller upload web service WSDL Webservices htt ps://ebill-ki.postfinance.ch/b2bwebservices/uploadinvoice.asmx?wsdl htt ps://ebill-ki.postfinance.ch/b2bwebservices/uploadinvoice.asmx Biller download web service WSDL Webservices htt ps://ebill-ki.postfinance.ch/b2bwebservices/billerdownloadservices.asmx?wsdl htt ps://ebill-ki.postfinance.ch/b2bwebservices/billerdownloadservices.asmx Payer download web service WSDL htt ps://ebill-ki.postfinance.ch/b2bwebservices/downloadinvoice.asmx?wsdl Webservices htt ps://ebill-ki.postfinance.ch/b2bwebservices/downloadinvoice.asmx 6.2 Links relating to production Biller upload web service WSDL Webservices htt ps://ebill.postfinance.ch/b2bwebservices/uploadinvoice.asmx?wsdl htt ps://ebill.postfinance.ch/b2bwebservices/uploadinvoice.asmx Biller download web service WSDL Webservices htt ps://ebill.postfinance.ch/b2bwebservices/billerdownloadservices.asmx?wsdl htt ps://ebill.postfinance.ch/b2bwebservices/billerdownloadservices.asmx Payer download web service WSDL Webservices htt ps://ebill.postfinance.ch/b2bwebservices/downloadinvoice.asmx?wsdl htt ps://ebill.postfinance.ch/b2bwebservices/downloadinvoice.asmx Manual Instruction for a client implementation of the B2B web service Version August 2013 20/20