Fixes to SOAP clients
[shibboleth/cpp-opensaml.git] / saml / saml1 / binding / SAML1SOAPClient.h
1 /*
2  *  Copyright 2001-2007 Internet2
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * @file saml/saml1/binding/SAML1SOAPClient.h
19  * 
20  * Specialized SOAPClient for SAML 1.x SOAP binding.
21  */
22
23 #ifndef __saml1_soap11client_h__
24 #define __saml1_soap11client_h__
25
26 #include <saml/binding/SOAPClient.h>
27
28 namespace opensaml {
29     namespace saml1p {
30         
31         class SAML_API Request;
32         class SAML_API Response;
33         class SAML_API Status;
34
35         /**
36          * Specialized SOAPClient for SAML 1.x SOAP binding.
37          */
38         class SAML_API SAML1SOAPClient : public opensaml::SOAPClient
39         {
40         public:
41             /**
42              * Creates a SOAP client instance with a particular SecurityPolicy.
43              * 
44              * @param policy        reference to SecurityPolicy to apply
45              * @param validating    controls schema validation
46              */
47             SAML1SOAPClient(SecurityPolicy& policy, bool validating=false) : opensaml::SOAPClient(policy, validating) {}
48             
49             virtual ~SAML1SOAPClient() {}
50     
51             /**
52              * Specialized method for sending SAML 1.x requests. The SOAP layer will be
53              * constructed automatically.
54              * 
55              * <p>The request will be freed by the client object if the method succeeds.
56              * 
57              * @param request   SAML request to send
58              * @param peer      peer to send message to, expressed in metadata terms
59              * @param endpoint  URL of endpoint to recieve message
60              */
61             virtual void sendSAML(Request* request, const saml2md::RoleDescriptor& peer, const char* endpoint);
62             
63             /**
64              * Specialized method for receiving SAML 1.x responses. The SOAP layer will be
65              * evaluated automatically, and the attached policy will be applied to the Response.
66              * 
67              * <p>The caller is responsible for freeing the Response.
68              * 
69              * @return SAML 1.x Response, after SecurityPolicy has been applied
70              */
71             virtual Response* receiveSAML();
72
73         protected:
74             /**
75              * Handling of SAML errors.
76              * 
77              * @param status SAML Status received by client
78              * @return true iff the error should be treated as a fatal error
79              */
80             virtual bool handleError(const Status& status);
81         };
82         
83     };
84 };
85
86 #endif /* __saml1_soap11client_h__ */