I've got a C# web application which I can't easily update the code of. However, I can make configuration changes to the application.
The application calls out to a third-party ASMX web service, and I really need (if at all possible) to log the full XML requests and responses. I have no control over the web service so I have to do it from the client.
I'm not using WCF - this is standard ASMX web service calls.
Is there any way I can log the XML requests and responses from the client web app without having to redeploy the code?
Thanks in advance
John
I don't know of any way to do this without changing the application. You might get away with creating a SoapExtension as a separate binary, then storing it in the \bin folder and changing the web.config to point to it. Still, adding a new binary may very well be considered "changing the application".
Certainly, ASMX has no configurable logging that does not require coding.
Related
Trying to understand which of the better modules to use for my page's specific need. Services module is popular, but that seems more for providing service, where the Web Service Client is good for consuming a web service.
Here's the requirement:
On the web page, I've got a form whose fields (location, service areas, region, indicators, etc) are to be built dynamically and some are selectable based on other selections. (So choosing worldwide would make Hubzone 8A not appear.)
Another team built the SOAP web service, it sits on another server outside the web server. What they delivered to me is a URL to invoke, basically an XML file:
http://webserviceurl.com:52901/navigator/NavigatorServices?wsdl
(Obviously, I just can't use the Feeds module to import the XML manually, right? The whole point of the web service approach is that as the data in the web service is updated, the Process form will by dynamic.)
So I'm really at the beginning of this. Need some guidance.
Web Service Client and SOAP Client are the ones that should do the work for you.
If you find it difficult to understand how to use them, you can simply use nuSOAP library + some PHP code inside a module. This article provides a good tutorial about providing and consuming Web Services using nuSOAP.
PHP provides a SOAP API. So you can simply create a module using this API (and Drupal Form API).
How do you put web services into maintenance mode?
I've tried the app_offline.htm, doesn't seem to work well for web services. Does work for web site though.
app_offline.htm worked fine for web sites, but not for web service. When I called an web service function via code that's supposedly under maintenance (put the app_offline.htm under the root directory of the IIS web service), I still got the proper response as usual.
Ideally I would like the web service that's under maintenance to return to me a message like "under maintenance".
You can edit your Global.asax as suggested by this answer to another question. Then trigger it by setting a flag when you are in maintenance mode
In my opinion, when a service is unavailable, you should respond with a 503 Service Unavailable status; but you can do anything you like with the response.
Create a utility function for your web services, which checks for the presence of app_offline.htm at your website's root path, and responds accordingly.
Note that if you wanted to get fancy with it, you could use a part of the WCF pipeline (assuming you're using WCF and not the legacy .ASMX services) to modify your services/methods by using an attribute (eg, this method).
I am using Axis2 (1.5.3 currently) and Tomcat (6.0.26 currently) and am running a web service. I would like to also host HTML pages for configuring the web service.
What is the best way to go about this? I assume keeping the same context is key, but perhaps it is not.
My current distribution is located under a folder structure similar to this:
Tomcat/webapps/mycompany
With the actual service code here:
Tomcat/webapps/mycompany/WEB-INF/services/myService
In a browser, I can hit my web service by going to here:
/mycompany/services/myService
I note that I can drop actual HTML files in this path and Tomcat will, indeed serve them up.
For instance, if I put "index.html" under Tomcat/webapps/mycompany, I can navigate to /mycompany/index.html and see my html.
What I want to do is have this HTML be attached to JAR/class files that can interact with the already-existing service class files in the same context as the service. Therefore, I can have the browser configure the web service directly.
Is this possible, and is there a tutorial or something out there that will help me with this? Note that I have been working with Tomcat and Axis2 for a while now for this particular web service, but I have never actually deployed a web application/html using Tomcat before.
Thanks.
First of all what do you mean by a configuring a service. Normally in SOA world services are analogous to interfaces. IMHO you can just change a service, since their are other users that rely on the services you are exposing.
If i want to change a service i would rather introduce a new version of the service after deprecating the existing one.
Are you talking about applying QoS to existing serviecs. Then that makes sense.
Anyway, If you want to have a web-app alongside with axis2 service engine, it is possible. If you look inside the axis2 war file you'll find the web.xml entry to Axis2Servlet. It is this servlet that serves the web services requests.
So, what you need is the Axis2Servlet mapping in your web-app along with your usual servlet-mappings. Number of possible ways to configure your services using web-app files. One options is to use web-services call itself to (with authentication) to configure it.
By "configure a service", take this example:
The service has a set of datasets.
Each dataset exists in a separate database.
The service can manage 0..n datasets.
The service must be configured to know about each dataset.
This is what I'm configuring. I'm not trying to configure Axis itself or redefine the service.
I would like to host the HTML using the same instance of Tomcat that I'm hosting the web service with. It needs to manage sessions, have login capability, an whatnot, and has to be able to configure the web service live.
From what I'm reading, it's probably best to make an interface to the web service that the web application module can call into from a different context.
Is there a better way?
Does web api have more advantage than socket communication when I am writing a software need calling server to function?
If we write a web api,do we can take advantage of http, http server, web app framework to do more thing with less work than doing the same function by socket ?
If my client call my server through internet, Do we have not any reason to not implement it as web api ?
I'd say that 'web API' is-kind-of a 'socket API'. While socket API may be basically anything running over sockets, web API is done using the HTTP protocol. That has a bit of limitation but usually the advantages are more important:
You reuse existing protocols and methods instead of re-inventing your own ones. That makes the work easier for you, and much easier for your users who do not have to implement everything from scratch;
You can use existing tools (and even a regular web browser) to debug your API. Well, with socket API you usually can use telnet but with more complex cases, a web browser or any HTTP querying tool is simpler to use;
You reuse HTTP ports 80 (and/or 443). That usually means it's less likely that any firewall will forbid your users to access the ports used by your service;
And after all, if you choose the right technologies, you can reuse them 'in' or even 'as' web pages. For example, you can use AJAX or similar technologies to catch data from your API in scripts on your web page.
Even better, if you just use XML for the API output, you can basically make it an API and a web page at the same time. You simply add a reference to an XSLT stylesheet to it, and whenever a web browser uses that API, it will use it to transform the raw XML into HTML.
Web services only output XML instead of HTML. The reasons why you should create a web service does not differs from the ones for creating a web site.
A web API can be called remotely.
A web API can be called in an independant manner. That means that you can allow you user (and you) to use an other interface that the one you build for the final customer.
You can program the API the way you want. The only requirment is to produce valid XML. So, yes you can use some framework, you are supposed to use a web server as the ones that output webpages.
If the client call your service throught Internet (SAAS), creating a web service allow you to give a new interface. Web services are required in order to use SOAP and to allow refreshing of webpages and also to give the datas to a heavy client.
I am looking for some good starting point for developing web-service.
I have one application which has C++ library support using which I can get all the details of the product.
I am supposed to write web service SDK for the same.
Any help.
Web services generally refer to a technique that allows code to be called via HTTP requests and responses. This is similar to a web page, except that what is returned from a web service is usually not HTML intended to be displayed in a browser - it is usually data of some kind.
"Web Service" is one of those terms that means whatever the person saying it means. Basically, its just a way to access data or functionality via http. There's a few standardized methods - REST, SOAP for web services, or you can just serve up XML, JSON, or other data from a plain old server side web app.
What you'd want to do is investigate what form this Web Server you are supposed to write needs to be in (SOAP, REST, something else), and then go from there.