Ejemplo n.º 1
0
        public virtual AnyCheckResponse AnyCheckRequest(AnyCheckRequest req)
        {
            // Create request header
            String action;
            action = "http://schemas.example.org/SimpleService/AnyCheckRequest";
            WsWsaHeader header;
            header = new WsWsaHeader(action, null, ServiceEndpoint, null, EndpointAddress, null);

            // Create request serializer
            AnyCheckRequestDataContractSerializer reqDcs;
            reqDcs = new AnyCheckRequestDataContractSerializer("AnyCheckRequest", "http://schemas.example.org/SimpleService");

            // Build soap request message
            byte[] soapBuffer = SoapMessageBuilder.BuildSoapMessage(header, reqDcs, req);

            // Send service request
            DpwsHttpClient httpClient;
            httpClient = new DpwsHttpClient();
            DpwsSoapResponse response;
            response = httpClient.SendRequest(soapBuffer, ServiceEndpoint, false, false);

            // Process response
            AnyCheckResponseDataContractSerializer respDcs;
            respDcs = new AnyCheckResponseDataContractSerializer("AnyCheckResponse", "http://schemas.example.org/SimpleService");
            AnyCheckResponse resp;
            resp = ((AnyCheckResponse)(respDcs.ReadObject(response.Reader)));
            return resp;
        }
 public void MyOneWayOperation(int a)
 {
     // Create HttpClient and send request
     Debug.Print("Sending Request:");
     byte[] request = BuildMyOneWayRequest(a);
     Debug.Print(new string(Encoding.UTF8.GetChars(request)));
     DpwsHttpClient httpClient = new DpwsHttpClient();
     httpClient.SendRequest(request, // soap message
                            this.serviceTransportAddress,
                            true, //is one-way?
                            false // is chunked?
                            );
 }
 public int MyTwoWayOperation(int a, int b)
 {
     // Create HttpClient and send request
     Debug.Print("Sending Request:");
     byte[] request = BuildMyTwoWayRequest(a, b);
     Debug.Print(new string(Encoding.UTF8.GetChars(request)));
     DpwsHttpClient httpClient = new DpwsHttpClient();
     DpwsSoapResponse response =
                  httpClient.SendRequest(request, // soap message
                                         this.serviceTransportAddress,
                                         false, //is one way?
                                         false // is chunked?
                                        );
     if (response == null)
         throw new InvalidOperationException("Two-way response was null.");
     //if (response.Header.Action == "http://schemas.xmlsoap.org/ws/2004/08/addressing/fault")
       //  throw new Exception();
     CheckFaultResponse(response);
     return ParseTwoWayResponse(response.Reader);
 }
 public int MyTwoWayOperation(int a, int b)
 {
     // Create HttpClient and send request
     Debug.Print("Sending Request:");
     byte[] request = BuildMyTwoWayRequest(a, b);
     Debug.Print(new string(Encoding.UTF8.GetChars(request)));
     DpwsHttpClient httpClient = new DpwsHttpClient();
     DpwsSoapResponse response =
                  httpClient.SendRequest(request, // soap message
                                         this.serviceTransportAddress,
                                         false, //is one way?
                                         false // is chunked?
                                        );
     if (response == null)
         throw new InvalidOperationException("Two-way response was null.");
     try
     {
         return ParseTwoWayResponse(response.Reader);
     }
     finally
     {
         response.Reader.Close();
     }
 }
Ejemplo n.º 5
0
        public virtual void OneWay(OneWay req)
        {
            // Create request header
            String action;
            action = "http://schemas.example.org/SimpleService/OneWay";
            WsWsaHeader header;
            header = new WsWsaHeader(action, null, ServiceEndpoint, null, EndpointAddress, null);

            // Create request serializer
            OneWayDataContractSerializer reqDcs;
            reqDcs = new OneWayDataContractSerializer("OneWay", "http://schemas.example.org/SimpleService");

            // Build soap request message
            byte[] soapBuffer = SoapMessageBuilder.BuildSoapMessage(header, reqDcs, req);

            // Send service request
            DpwsHttpClient httpClient;
            httpClient = new DpwsHttpClient();
            DpwsSoapResponse response;
            response = httpClient.SendRequest(soapBuffer, ServiceEndpoint, true, false);
        }