Jump to content

Search the Community

Showing results for tags 'soap'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 7 results

  1. I'm a student/Intern at an Agency and I was asked to test an HTTP request to a server using a code given in the servers doc which goes like this : <?php $client = new httpClient; $request = new http\Client\Request; $body = new http\Message\Body; $body->append(' <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <WebServiceDiva xmlns="http://www.Divalto.fr/WebService/"> <action>&lt;action&gt;WP_CREATECLI</action> <param> {licence:"XXXXX=",client: {"dos":"2","nom":"Alex Xela","adr1":"53 Bd Carnot","adr2":"","adr3":"","adr4":"","cpostal":"06400","vil":"Cannes","tel":"053837979","email":"[email protected]","siret":"","naf":"","regcod":"CB","tvatie":"0","catclicod":"","tacod":"","tarcod":"","blmod":"DPD","texcod1":"","texcod2":"","texcod3":"","texcod4":"","tvano":"","visa":"2"},adresse: {"nom":"Alex Xela","adr1":"53 Bd Carnot","adr2":"","adr3":"","adr4":"","cpostal":"06400","ville":"","tel":"053837979","email":"[email protected]","livprincipale":"2","facprincipale":""},contact: {"contact":"Customer","nom":"Alex Xela","prenom":"","tit":"","lib":"","tel":"","telgsm":"","fax":"","email":"[email protected]","servcod":"","fctcod":""},banque: {"ribcod":"","ribdo":"","iban1":"","iban2":"","iban3":""}} </param> </WebServiceDiva> </soap:Body> </soap:Envelope> '); $request->setRequestUrl('https://divaltosainteroseline.coaxis.com/WebServiceDiva/WebServiceDiva.asmx'); $request->setRequestMethod('POST'); $request->setBody($body); $request->setHeaders(array( 'accept-encoding' => 'gzip', 'content-type' => 'text/xml' )); $client->enqueue($request)->send(); $response = $client->getResponse(); echo $response->getBody(); ?> The problem is I can't even get throught the first lines when I execute the code, It says that there is no class Http\Client or Http\Client\Message or Http\Client\Request. and I looked for these classes in php doc but couldn't find anything. also after 3 days of research I only found SaopClient and SoapCall Classes that really treat HTTP and SOAP communication but the tech guy at the server company tells me that this is the way to connect using php and I'm completely lost and need ur help
  2. Good morning guys. I am pulling data from vehicle tracking site via soap curl. but the data format that I am getting it in is unusable, maybee i am doing something wrong. please have a look. here is the code. <?php //Data, connection, auth $dataFromTheForm = $_POST['fieldName']; // request data from the form $soapUrl = "https://fleet11.******.co.za/api/"; // asmx URL of WSDL $soapUser = "********"; // username $soapPassword = "********"; // password // xml post structure $xml_post_string = '<?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="fleet11.cartrack.co.za/api/"> <soapenv:Header/> <soapenv:Body> <api:endpoint.get_vehicle_last_positions soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <username xsi:type="xsd:string">?</username> </api:endpoint.get_vehicle_last_positions> </soapenv:Body> </soapenv:Envelope>'; $headers = array( "Content-type: application/x-www-form-urlencoded", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", "SOAPAction: fleet11.******.co.za/api/#get_vehicle_last_positions", "Content-length: ".strlen($xml_post_string), ); $url = $soapUrl; // var_dump($url); $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); `curl_setopt($ch, CURLOPT_HEADER, true);` // converting $response = curl_exec($ch); curl_close($ch); //paul add //echo "<pre>"; print_r($response); What is returning is single line entries How di i get this into a format to import into mysql
  3. Hi all, I am a Junior Developer, I have taken over someone's implementation of a web service and am struggling. They used python to access the methods. I can access the web service via Python and connect it to our databases, but it is really slow. I believe that PHP would make it faster, but I am not able to make the right connections. Any help would be really appreciated. I have included some code snippets below, Thank you, Jim ###################################################################### Python ###################################################################### #!/usr/bin/python ###################################################################### # Module imports ###################################################################### from suds.client import Client from suds.wsse import * from xml.dom import minidom import MySQLdb ###################################################################### # Address Interface. ###################################################################### class Address(object): def __init__(self, ttl=600): # Constants. self._USERNAME = 'username' self._PASSWORD = 'password' self._address_search_url = 'https://jim.svc?wsdl' # SOAP security setup. self._security = Security() self._token = UsernameToken(self._USERNAME, self._PASSWORD) self._security.tokens.append(self._token) #print 'Starting Address Search.' self._address_search_client = Client(self._address_search_url) self._address_search_client.set_options(wsse=self._security) # Addresses. ######################################################## def address_search_by_postcode(self, postcode): RegsRegionType = self._address_search_client.factory.create('ns1:RegsRegionType') regs_region = RegsRegionType.Scotland address_data = self._address_search_client.service.SearchAddressByPostCode(regs_region, RegisterType.Domestic, postcode, '') addrs = [] for addr in address_data.keys.string: address_dom = minidom.parseString(addr.encode('utf-8')) ob = {} #Get addr details addrs.append(ob) return addrs ###################################################################### def get_data(d, t): try: return d.getElementsByTagName(t)[0].childNodes[0].data except: return None ###################################################################### PHP ###################################################################### <?php error_reporting(E_ALL); ini_set('display_errors', 'on'); $username = "username"; $password = 'password'; $wsdl = "https://jim.svc?wsdl"; // SOAP security setup $options = array( 'login' => $username, 'password' => $password, ); /////////////////////////////////////////////////////////////////////////////// Connect ////////////////////////////////////////////////////////////////////////////// $client = new SoapClient($wsdl, $options); ////////////////////////////////////////////////////////////////////////////// define wsse security ////////////////////////////////////////////////////////////////////////////// $securityNamespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; $headerContent = "<o:Security xmlns:o=\"$securityNamespace\"> <o:UsernameToken> <o:Username>USERNAME</o:Username> <o:Password>PASSWORD</o:Password> </o:UsernameToken> </o:Security>"; $headerVar = new SoapVar($headerContent, XSD_ANYXML, null, null, null); $header = new SoapHeader($securityNamespace, 'o:Security', $headerVar); ////////////////////////////////////////////////////////////////////////////// Authenticate ////////////////////////////////////////////////////////////////////////////// $client->__setSoapHeaders(array($header)); var_dump($client->__getFunctions()); try{ $result = $client->SearchAddressByPostCode($regsRegion, $registerType, $postCode, " "); print_r($result); }catch (SoapFault $exception){ var_dump($exception); } print('done'); ?> ////////////////////////////////////////////////////////////////////////////// END ////////////////////////////////////////////////////////////////////////////// Hope someone can help and point me in the right direction Thanks JIm
  4. I'm trying to use the code below to make a SOAP request to a vendor's web service: $client = new SoapClient('http://my.domain.com/wsdl/GuestService.WSDL', array('connection_timeout' => 15, 'trace' => 1)); $ns = 'http://vendor.domain.com/'; $headerbody = array('brand' => 'BRAND1', 'locale' => 'en_us', 'securityCredentials'=>array('applicationId'=>'ABCDEF', 'token'=>'123456789123456789123456789')); $header = new SoapHeader($ns, 'Header', $headerbody); $client->__setSoapHeaders($header); $result = $client->getGuest(array('guestID' => '000787')); However, I'm getting an error back that no credentials were supplied so I must be doing something wrong. Error message: Uncaught SoapFault exception: [soapenv:NO_CREDENTIALS] I reached out to the vendor and they sent me an XML sample of how they're expecting to receive the data: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prox="http://vendor.domain.com" xmlns:gues="http://vendor.domain.com/guest"> <soapenv:Header> <prox:brand>BRAND1</prox:brand> <prox:locale>en_us</prox:locale> <prox:securityCredentials> <prox:applicationId>ABCDEF</prox:applicationId> <prox:token> 123456789123456789123456789</prox:token> </prox:securityCredentials> </soapenv:Header> <soapenv:Body> <gues:getGuest> <guestID>000787</guestID> </gues:getGuest> </soapenv:Body> </soapenv:Envelope> I thought I had accounted for everything in the above but maybe I'm missing something obvious. Really appreciate any help!
  5. I will warn you that i have never used PHP to call a web service but have spent the last 2 days googling with trial and error and think that i have come to a point where i have no idea what to do as nothing is working. Here is my PHP code... <?php $soapclient = new SoapClient('Link-To-EndPoint'); $params = array('Username' => 'Username', 'Password' => 'Password', 'clientRequestId' => 1, 'projectNumber' => 64111, 'requestDateTime' => '2014-03-16T11:05:24.572Z', 'itemNumber' => 'F00573019120B', 'projectNumber' => 64111 ); $response = $soapclient->GetItemDetailInfo($params); echo '<pre>'; var_dump($response); echo '</pre>'; ?> And here is the request, probably worth noting that this gives the full response and works when i use SOAP UI to make the request. <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Header> <Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <UsernameToken> <Username>Username</Username> <Password>Password</Password> </UsernameToken> </Security> </env:Header> <env:Body> <getItemDetailInfoRequest> <requestHeader> <clientRequestId>1</clientRequestId> <projectNumber>64111</projectNumber> <requestDateTime>2014-03-20T14:05:24.572Z</requestDateTime> </requestHeader> <getItemDetailInfoList> <itemDetailSearchCriteria> <itemNumber>F00573019120B</itemNumber> <projectNumber>64111</projectNumber> </itemDetailSearchCriteria> </getItemDetailInfoList> </getItemDetailInfoRequest> </env:Body> </env:Envelope> When i load the page i get a blank screen nothing comes out from $response, I have no idea if i am close to making this work or if i am super far off with this. Using the above code i am able to make a public weather SOAP Web Service work which makes me think i am close. Any help would be appreciated!
  6. I'm trying to use an API to submit a form and I'm not sure what I'm supposed to do with the ProcessName. This is the error I'm getting: 90028910falseInvalid Process Name0 <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.securecrmsite.com/"> <SOAP-ENV:Body> <ns1:Process> <ns1:Credentials> <ns1:CompanyKey>xxxx</ns1:CompanyKey> <ns1:APIKey>xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</ns1:APIKey> </ns1:Credentials> </ns1:Process> <param1> <item> <key>ProcessName</key> <value>CompanyInsert</value> </item> <item> <key>FirstName</key> <value>From</value> </item> <item> <key>LastName</key> <value>API</value> </item> </param1> </SOAP-ENV:Body> </SOAP-ENV:Envelope> And this is the code I have: $compKey = 'xxxx'; $apiKey = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'; $soapURL = "https://www.securecrmsite.com/Modules/System/API.asmx?wsdl"; $soapCredentials = array('Credentials'=>array('CompanyKey' => $compKey, 'APIKey' => $apiKey)); $soapFunctionParameters = array('ProcessName' => "CompanyInsert", 'FirstName' => "From", 'LastName' => "API"); $client = new SoapClient($soapURL, array('trace' => true)); $client->Process($soapCredentials, $soapFunctionParameters); echo $client->__getLastResponse(); If anyone has any ideas, they'd be greatly appreciated! I don't have much experience working with APIs. Thanks.
  7. Hello All, I have developed a WCF service with htttps enabled.I have tested in .NET environment by creating a .NET windows client and consumed the service.I want to consume the same service php.I am new to php.I have written the below code <?php class WsseAuthHeader extends SoapHeader { private $wss_ns = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'; function __construct($user, $pass, $ns = null) { if ($ns) { $this->wss_ns = $ns; } $auth = new stdClass(); $auth->Username = new SoapVar($user, XSD_STRING, NULL, $this->wss_ns, NULL, $this->wss_ns); $auth->Password = new SoapVar($pass, XSD_STRING, NULL, $this->wss_ns, NULL, $this->wss_ns); $username_token = new stdClass(); $username_token->UsernameToken = new SoapVar($auth, SOAP_ENC_OBJECT, NULL, $this->wss_ns, 'UsernameToken', $this->wss_ns); $security_sv = new SoapVar( new SoapVar($username_token, SOAP_ENC_OBJECT, NULL, $this->wss_ns, 'UsernameToken', $this->wss_ns), SOAP_ENC_OBJECT, NULL, $this->wss_ns, 'Security', $this->wss_ns); parent::__construct($this->wss_ns, 'Security', $security_sv, true); } } $my_cert_file=".../wamp/mycert.pem"; $options = array('soap_version' => SOAP_1_2, 'exceptions' => TRUE, 'trace' => TRUE, 'wdsl_local_copy' => TRUE, 'style' => SOAP_DOCUMENT, 'use' => SOAP_AUTHENTICATION_DIGEST, 'encoding' => SOAP_ENCODED, 'cache_wsdl' => WSDL_CACHE_NONE, 'local_cert' => $my_cert_file); $username = "TestUser"; $password = "second"; $wsse_header = new WsseAuthHeader($username, $password); $client = new SoapClient('https://192.168.0.120/TravelPlanService.svc?wsdl',$options); $client->__setSoapHeaders(array($wsse_header)); try { $phpresponse= $client->Authenticate(); // print $phpresponse->GetResult->Version; echo (bool)$phpresponse->AuthenticateResult; echo "</b><BR/><BR/>"; } catch(Exception $e) { echo "<h2>Exception Error!</h2></b>"; echo $e->getMessage(); } ?> I have created a self signed certificate through online. Please provide me the solution to consume the HTTPS service in PHP .
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.