Skip to content

Commit

Permalink
Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
hungnguyenhp committed Mar 20, 2023
1 parent bf5ad17 commit 581d3d3
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 6 deletions.
27 changes: 25 additions & 2 deletions classes/nusoap.php
Original file line number Diff line number Diff line change
Expand Up @@ -3533,7 +3533,7 @@ function getCookiesForRequest($cookies, $secure = false)
}
}
if ((isset($cookie['domain'])) && (!empty($cookie['domain']))) {
$domain = preg_quote($cookie['domain']);
$domain = preg_quote($cookie['domain'], "'");
if (!preg_match("'.*$domain$'i", $this->host)) {
$this->debug('cookie has different domain');
continue;
Expand Down Expand Up @@ -7623,7 +7623,7 @@ function call($operation, $params = array(), $namespace = 'http://tempuri.org',
$this->faultstring = '';
$this->faultcode = '';
$this->opData = array();

$usewrapped = false;
$this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType");
$this->appendDebug('params=' . $this->varDump($params));
$this->appendDebug('headers=' . $this->varDump($headers));
Expand Down Expand Up @@ -7697,6 +7697,14 @@ function call($operation, $params = array(), $namespace = 'http://tempuri.org',
$nsPrefix = 'ns' . rand(1000, 9999);
// serialize
$payload = '';
if ($use = 'literal wrapped') {
// 'literal wrapped' is only sensible (and defined) for 'document'.
if ($style == 'document') {
$usewrapped = true;
}
// For compatibility with the rest of the code:
$use = 'literal';
}
if (is_string($params)) {
$this->debug("serializing param string for operation $operation");
$payload = $params;
Expand All @@ -7717,6 +7725,21 @@ function call($operation, $params = array(), $namespace = 'http://tempuri.org',
$encodingStyle = '';
}
}
// wrap document/literal wrapped calls with operation element
if ($usewrapped) {
// (This code block was based on http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/
// and tailored to the needs of one specific SOAP server, where no nsPrefix was seen...
$this->debug("wrapping document request with literal method element");

if ($namespace) {
$payload = "<$operation xmlns=\"$namespace\">" .
$payload .
"</$operation>";
} else {
$payload = "<$operation>" . $payload . "</$operation>";
}
}

// wrap RPC calls with method element
if ($style == 'rpc') {
if ($use == 'literal') {
Expand Down
25 changes: 24 additions & 1 deletion fixed/nusoap_client.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function call($operation, $params = array(), $namespace = 'http://tempuri.org',
$this->faultstring = '';
$this->faultcode = '';
$this->opData = array();

$usewrapped = false;
$this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType");
$this->appendDebug('params=' . $this->varDump($params));
$this->appendDebug('headers=' . $this->varDump($headers));
Expand Down Expand Up @@ -244,6 +244,14 @@ function call($operation, $params = array(), $namespace = 'http://tempuri.org',
$nsPrefix = 'ns' . rand(1000, 9999);
// serialize
$payload = '';
if ($use = 'literal wrapped') {
// 'literal wrapped' is only sensible (and defined) for 'document'.
if ($style == 'document') {
$usewrapped = true;
}
// For compatibility with the rest of the code:
$use = 'literal';
}
if (is_string($params)) {
$this->debug("serializing param string for operation $operation");
$payload = $params;
Expand All @@ -264,6 +272,21 @@ function call($operation, $params = array(), $namespace = 'http://tempuri.org',
$encodingStyle = '';
}
}
// wrap document/literal wrapped calls with operation element
if ($usewrapped) {
// (This code block was based on http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/
// and tailored to the needs of one specific SOAP server, where no nsPrefix was seen...
$this->debug("wrapping document request with literal method element");

if ($namespace) {
$payload = "<$operation xmlns=\"$namespace\">" .
$payload .
"</$operation>";
} else {
$payload = "<$operation>" . $payload . "</$operation>";
}
}

// wrap RPC calls with method element
if ($style == 'rpc') {
if ($use == 'literal') {
Expand Down
2 changes: 1 addition & 1 deletion fixed/soap_transport_http.php
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ function getCookiesForRequest($cookies, $secure = false)
}
}
if ((isset($cookie['domain'])) && (!empty($cookie['domain']))) {
$domain = preg_quote($cookie['domain']);
$domain = preg_quote($cookie['domain'], "'");
if (!preg_match("'.*$domain$'i", $this->host)) {
$this->debug('cookie has different domain');
continue;
Expand Down
25 changes: 24 additions & 1 deletion src/nusoap_client.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function call($operation, $params = array(), $namespace = 'http://tempuri.org',
$this->faultstring = '';
$this->faultcode = '';
$this->opData = array();

$usewrapped = false;
$this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType");
$this->appendDebug('params=' . $this->varDump($params));
$this->appendDebug('headers=' . $this->varDump($headers));
Expand Down Expand Up @@ -244,6 +244,14 @@ function call($operation, $params = array(), $namespace = 'http://tempuri.org',
$nsPrefix = 'ns' . rand(1000, 9999);
// serialize
$payload = '';
if ($use = 'literal wrapped') {
// 'literal wrapped' is only sensible (and defined) for 'document'.
if ($style == 'document') {
$usewrapped = true;
}
// For compatibility with the rest of the code:
$use = 'literal';
}
if (is_string($params)) {
$this->debug("serializing param string for operation $operation");
$payload = $params;
Expand All @@ -264,6 +272,21 @@ function call($operation, $params = array(), $namespace = 'http://tempuri.org',
$encodingStyle = '';
}
}
// wrap document/literal wrapped calls with operation element
if ($usewrapped) {
// (This code block was based on http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/
// and tailored to the needs of one specific SOAP server, where no nsPrefix was seen...
$this->debug("wrapping document request with literal method element");

if ($namespace) {
$payload = "<$operation xmlns=\"$namespace\">" .
$payload .
"</$operation>";
} else {
$payload = "<$operation>" . $payload . "</$operation>";
}
}

// wrap RPC calls with method element
if ($style == 'rpc') {
if ($use == 'literal') {
Expand Down
2 changes: 1 addition & 1 deletion src/soap_transport_http.php
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ function getCookiesForRequest($cookies, $secure = false)
}
}
if ((isset($cookie['domain'])) && (!empty($cookie['domain']))) {
$domain = preg_quote($cookie['domain']);
$domain = preg_quote($cookie['domain'], "'");
if (!preg_match("'.*$domain$'i", $this->host)) {
$this->debug('cookie has different domain');
continue;
Expand Down

0 comments on commit 581d3d3

Please sign in to comment.