Esempio n. 1
0
        private void  DesignatePrinter(String token)
        {
            DesignatePrinter.DesignatePrinterPortTypeClient client = DesignatePrinterService.returnClient(token);

            DesignatePrinter.MessageHeader message_header = DesignatePrinterService.returnMessageHeader();
            DesignatePrinter.Security1     security       = DesignatePrinterService.returnSecurityHeader(token);

            DesignatePrinter.DesignatePrinterRQ req = DesignatePrinterService.getRequest(token, "1");
            SerializeAndShowWSResponse(req);

            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

            DesignatePrinter.DesignatePrinterRS response = null;
            try
            {
                response = client.DesignatePrinterRQ(ref message_header, ref security, req);

                SerializeAndShowWSResponse(response);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.StackTrace + "\"" + e.Message);
                Debug.Write(e.StackTrace);
                Debug.Write(e.Message);
            }
            finally
            {
            }
        }
        public static DesignatePrinter.MessageHeader returnMessageHeader()
        {
            DesignatePrinter.MessageHeader message_header = new DesignatePrinter.MessageHeader();

            DateTime now = DateTime.Now;

            // from
            DesignatePrinter.From      from           = new DesignatePrinter.From();
            DesignatePrinter.PartyId   fromPartyId    = new DesignatePrinter.PartyId();
            DesignatePrinter.PartyId[] fromPartyIdArr = new DesignatePrinter.PartyId[1];
            fromPartyId.Value   = "WebServiceClient";
            fromPartyIdArr[0]   = fromPartyId;
            from.PartyId        = fromPartyIdArr;
            message_header.From = from;

            // to

            DesignatePrinter.To        to           = new DesignatePrinter.To();
            DesignatePrinter.PartyId   toPartyId    = new DesignatePrinter.PartyId();
            DesignatePrinter.PartyId[] toPartyIdArr = new DesignatePrinter.PartyId[1];
            toPartyId.Value   = "WebServiceSupplier";
            toPartyIdArr[0]   = toPartyId;
            to.PartyId        = toPartyIdArr;
            message_header.To = to;

            message_header.Action = "DesignatePrinterLLSRQ";
            message_header.CPAId  = "IPCC";
            DesignatePrinter.Service service = new DesignatePrinter.Service();
            service.Value = "DesignatePrinterLLSRQ";

            message_header.Service = service;
            DesignatePrinter.MessageData message_data = new DesignatePrinter.MessageData();
            message_data.MessageId      = "2529036674227040150";
            message_data.RefToMessageId = "mid:[email protected]";
            message_data.Timestamp      = now.ToString();

            message_header.MessageData = message_data;
            // conversation id seems to accept a timestamp


            message_header.ConversationId = now.ToLongDateString();

            return(message_header);
        }