I have a web server which is acting as a SOAP client to communicate with a third party SOAP server. My client is implemented in PHP using php::soapclient.
What is the best way to verify the SOAP server is functioning so I can provide the client browser with the site otherwise if if the SOAP server is down or not responding inform the user that the service is currently not available?
The system essentially provides a mashup of the third party services offered by using SOAP client/server communication to display data to the browser and let the users interact with the third party system.
well... once i worked with a php soap server and a php soap client. I think that when the client calls the service, it passes through the wsdl and if there's a problem during the conection (or even the execution) server side, the response of the client will be a SoapFault object.. id di something like
$resp = $this->client->__soapCall($serviceName,$serviceParams);
if (get_class($resp)=="SoapFault"){
throw new Exception("Webservice error - Message: ".$resp->faultstring);
}
You could call the http://server:1234/foo/bar?wsdl and if you do get the WSDL back, fire the actual SOAP request.
If the application is down, you probably won't get the WSDL and if it's only a part of the service that makes it hang, there is not much you can do to detect it beforehand anyway.
Related
I'm an experienced data analist with mostly SQL and R experience, little Python, and unfortunately little .NET and PHP exposure. I have searched extensively for anyone with a similar questions, but unfortunately I haven't found what I'm looking for.
Situation: I'm setting up an HDInsight cluster on Azure (with Apache Spark) and I need to pull in some data from a SOAP API (no restful API).
Problem: Where and how do I pull this data in? I thought the Logic App in Azure would be a suitable place. However, I don't quite succeed in calling on this API.
I do have a working PHP script with a proper API call. Here is a (part of) the syntax.
$client = new SoapClient('http://someURL?wsdl');
$webservice = new SoapClient('http://someotherURL?wsdl');
$session = $client->someOperationToLogin($var1, $var2, $var3);
$operation = $webservice->someOperationToGetData($session, $var4, $var5);
$session = $client->logout($session);
As you can see, I first need to obtain a session id and then use this session id in subsequent calls. As far as I understand, I can't get to this data through a simple HTTP request.
Questions:
Can I call this particular SOAP API directly through one of the existing connectors in the Azure Logic App
If (1) is not possible, can I make use of the existing PHP script? How and where?
Is there any other route I can follow to make use of the data through this SOAP API? For instance: using pyspark in the Spark/HDInsight Cluster?
I really appreciate your help and pointers.
You Can Make The Call Through The Normal HTTP Connector.
1- First Set Your Http trigger method to post and send it your xml Body.
HTTP Trigger
2- Make An Http Action with the url to Your Soap End like
abc.asmx
xyz.svc Http Call To Soap End
Don`t forget to set the Method To Post and Content-Type to text/xml as a header.
3- Finally Bind your Http Response to response action set the status code and body To the HTTP Action Status and Body Dynamically don`t forget to set to content type Here to text/xml as well Return Response Action
4- Finally Configure the run After for response component to sun after HttP Action Even If Faild , Cancled or time out Just to pass the Status code for every call Like That Right click on Response and configure run after conf Run After For response Action .
Here is The Full View Full Flow.
Like The Response If This helps.
There are no SOAP APIs called thru the existing connectors in Azure Logic App.
This is a list of Connectors and API Apps Reference: https://msdn.microsoft.com/en-us/library/azure/dn948518.aspx.
Their supported functions are all based on REST APIs via Http/Https.
All services & apis on Azure are almost based on REST APIs to compatible with crossover platform & language scenes.
But even so, you can create own SOAP APIs thru Azure App Service or Cloud Service.Please refer to http://azure.microsoft.com/en-us/documentation/services/app-service/api/ and https://azure.microsoft.com/en-us/documentation/articles/app-service-logic-arm-with-api-app-provision/.
In Azure HDInsight, you can pull in some data from Storage Service and Service Bus. If you want to use Azure Logic App, the exisiting connectors are Blob Connector and ServiceBus Connector, and even Dropbox Connector.
You can refer to the references below to use PHP script to access the Azure Storage & ServiceBus services linked as HDInsight resources to store/get or send/receive some data.
1.https://azure.microsoft.com/en-us/documentation/articles/storage-php-how-to-use-blobs/
2.https://azure.microsoft.com/en-us/documentation/articles/service-bus-php-how-to-use-queues/.
Best Regards.
It is now possible to create a REST API from a SOAP WSDL file through Azure API Management using the SOAP to Rest feature.
This can be accessed from:
Azure portal -> API Management services -> <Your API Management Service> -> APIs -> Add API -> WSDL
After this is set up, it is easy to access this API from other Azure products.
I have been trying to call a webservice that is in dotnet platform from a client prepared in php.
New to the webservice business and trying my best ...... but I have been unable to send objects from php as client to the dotnet webserver. If anyone could suggest a basic idea or point me to any resource of study where one can send php objects using SOAP to a dotnet it'll be a bunch of help.
Probably you need to learn a bit more on how to call SOAP web services from PHP. This question seems to provide a good overview on that: PHP SOAP client Tutorial/Recommendation?
Furthermore, give more details on your concrete problems: what are you being unable to do (more details), what have you already developed/tested?
Finally, when working with SOAP web services you do (should!) not need to care about how the web service is implemented. SOAP is a protocol for managing/specifying the communications between a client and a server (with the web service). The actual internal implementation of the web service should never matter, only its "interface" that normally is defined in the WSDL document.
HTH.
I am trying to setup my server so that I can have someone contact me through a chatbox on our website. Since I won't be there at all times to monitor the chats, I am trying to setup a system where the chat is routed through a websocket to my server (using PHP-Websockets) which is then sent to my phone via sms. This is all working correctly. I am having trouble wrapping my head around how my response can get back to the client side. When I respond to a text, Twilio will access any page that I specify with the sms message as a post variable. How can I pass this post message to my websocket (which is already running) where it can then send the message back to the client? Thanks for your help guys
Twilio communicates with your application via a WebHook call (HTTP request) when it receives your SMS.
Since PHP-WebSockets is running as a standalone process, and not as part of an existing web stack (e.g. Apache) then you'll need to have a few components in your setup:
PHP-WebSocket
Web server - serving up your HTML, CSS etc and also interacted with by the Twilio WebHook
A way for 1. and 2. to interact. This is usually achieved through some sort of message queue
Here's a sequence diagram that details the communication between the various components in your setup, as I see it:
Hopefully that clarifies the communication from Twilio, your web server, your WebSocket server and your client.
If this seems overly complicated then you could remove the requirement to have the WebSocket server and message queue by using a hosted service such as Pusher, who I work for. If that is the case then this using Pusher & Twilio tutorial should be useful. One of the main benefits here is that you can continue to think in terms of request and response, rather than having to think about cross component communications through message queues.
Hey!
I don't really understand what soap is but it doesn't matter. I need to make some soap site that redirect to normal site or have simple content in it like 'test'.
I will need to acces it by soap:// ---- is it ever possible ?
Never good idea to use something that you classify as "I don't really understand what soap is but it doesn't matter"
http://www.w3schools.com/SOAP/soap_intro.asp
Go through it its quite good and simple
And yea its not possible at least to my knowledge
And if you do not feel like clicking link this might help (from w3schools.com)
What is SOAP?
SOAP stands for Simple Object Access Protocol
SOAP is a communication protocol
SOAP is for communication between applications
SOAP is a format for sending messages
SOAP communicates via Internet
SOAP is platform independent
SOAP is language independent
SOAP is based on XML
SOAP is simple and extensible
SOAP allows you to get around firewalls
SOAP is a W3C recommendation
No it's not really possible. Yes, it does mater if you understand what SOAP is.
You can't redirect from a SOAP "site" to a "normal" site. That's because there are no SOAP "sites". SOAP uses XML that is not able to be parsed by a web browser. The web browser needs to do the redirecting.
If you mean to say that you want a certain URL that runs a SOAP service to redirect web browsers to a different page, then you'll have to look reading the user agent, and giving the appropriate response.
This is in fact a useful and good idea if you are developing a SOAP service, but it doesn't sound like that's what you are doing.
I have a WCF web service which allows both Basic HTTP and WS-HTTP clients, both over HTTPS using user name & password authentication. This is achieved with two bindings on the same service.
So, the service is at https://foo.com/Service.svc, the Basic HTTP (SOAP 1.1) endpoint is https://foo.com/Service.svc/Unp11, and the WS-HTTP (SOAP 1.2) endpoint is https://foo.com/Service.svc/Unp .
A client is trying to access this web service via PHP 5, using its built-in SOAP support, and is having trouble connecting to the service. He keeps getting an HTTP 400 (Bad Request) response, which tends to happen if the SOAP message is badly formed, or a SOAP 1.1 message is sent to a SOAP 1.2 endpoint (or vice versa).
I only know basic PHP so I'm having trouble helping him. I know you can create a client by doing
$client = new SoapClient('https://foo.com/Service.svc?wsdl');
but how do you specify the binding/endpoint? Are there any known issues achieving all this with PHP?
UPDATE
Ok, so I can use PHP to connect to the WCF service ok (specifying the SOAP version in the SoapClient constructor), and calling $client->__getFunctions() returns a correct list of all the web service operations.
When I try to call one using $client->__soapCall, the page just sits there loading for quite a while, and eventually returns the error "Error Fetching http headers". What exactly is this supposed to mean and how do I fix it? (Consuming the service from .Net client works perfectly.)
Just ran into this today, creating a WCF with multiple bindings for a PHP caller. Setting the location appears to allow for both the WSDL version of PHP's SoapClient and specifying a binding to use.
WCF config is (1 service with 2 bindings wsHttp and basicHttp), pretty straight-forward.
PHP code:
$client = new SoapClient("http://example.com/service.svc?wsdl");
$client->__setLocation("http://example.com/service.svc/basic");
$response = $client->MethodName(array( "paramName" => "paramValue" ... ));
We have a SOAP service which has several bindings. In C# when you add a service reference to a wsdl you get a class created for each one, but in PHP it seems you can't specify which binding you want to use - this has caused me problems when the bindings have conflicting type/method names. It does seem to generally work out OK though but I don't really know how it is dealing with it internally.
The other common problem I have had is that I always have to wrap up the parameters in loads of arrays or structs - sometimes you get a Bad Request back if the server is expecting a parameter and you haven't quite set it correctly. (see Having trouble getting my head around SOAP in PHP)
Not sure this is much help, just some thoughts. There are also some third-party Soap client implementations written in PHP that could be worth looking at, but they will be quite a lot slower.