1c2920b32c9bc8439f761037e36bae1c37ccc698
[WP-Plugins/glm-member-db-registrations.git] /
1 <?php
2 namespace PayPal\Formatter;
3 class PPSOAPFormatter implements IPPFormatter {
4         
5         private static $SOAP_NAMESPACE = ' xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" ';
6         
7         public function toString($request, $options=array()) {
8                                 
9                 $customNamespace = ( $request->getBindingInfo('namespace') != null ) ?  $request->getBindingInfo('namespace') : "";
10                 $soapEnvelope = '<soapenv:Envelope ' . self::$SOAP_NAMESPACE . " $customNamespace >";
11
12                 $soapHeader = '<soapenv:Header>';
13                 if($request->getBindingInfo('securityHeader') != null) {
14                         $soapHeader .= $request->getBindingInfo('securityHeader');
15                 }               
16                 $soapHeader .= '</soapenv:Header>';
17                                 
18                 $soapBody = '<soapenv:Body>';
19                 $soapBody .= $request->getRequestObject()->toXMLString();
20                 $soapBody .= '</soapenv:Body>';
21                 
22                 return $soapEnvelope . $soapHeader . $soapBody . '</soapenv:Envelope>';
23         }
24         
25         public function toObject($string, $options=array()) {
26                 throw new BadMethodCallException("Unimplemented");
27         }       
28 }