Calling SOAP WebServices with Client Side Blazor - web-services

I need to call an old SOAP web service from a client-size Blazor app.
TS.ThumbserverSoapClient req = new TS.ThumbserverSoapClient(TS.TSSoapClient.EndpointConfiguration.TSSoap12); var imageData = await req.GetThumbnailAsync(1000, 200, "width");
It runs with the error; "Cannot wait on monitors on this runtime."
This appears to relate to Blazor running on a single thread.
You can run it with, or without, the "await" and it's the same error.
Should it really be the case that all old SOAP w/s just need re-writing, or is there a way around this?

Related

Create a persistent node-soap client

I have a cpp based soap application which supports multiple sessions. It follows this sequence
Create a new session. This returns a new session ID.
Make further requests on this same client to do some work which uses same process but unique thread assigned to this client will intercept these calls.
Close Session by providing the session ID. This will clean up the thread.
Now this is working fine when I'm using a cpp based client which creates a soap client like this
soap_init2(&soap, SOAP_IO_KEEPALIVE | SOAP_C_UTFSTRING, SOAP_IO_KEEPALIVE | SOAP_C_UTFSTRING);
Creats a session does some work on it and ends the session and finally calls
soap_destroy(&soap); soap_end (&soap); soap_done (&soap); // Cleanup soap context
to perform the cleanup of the client. But I want to achieve same thing using a node-js server/application for that I used node's soap module. Basic things seems to be working as well. For example I was able to make soap requests to the server for create session and some other tasks. But when I try to use the same session again my cpp application's worker thread is not intercepting these calls but every-time these calls to go my root session(the thread that initiated the soap server/or which initiates new sessions). Hence I'm not able to use the session management provided by the soap server.
Here is how I creates soap client.
const wsdlOptions = {
"envelopeKey": 'soapenv',
"disableCache": true,
connection: 'keep-alive'
};
soap.createClient(url, wsdlOptions, function (err, client) {
if (err) {
// Return job failure. As this is due to an SOAP client error, let us restart.
logUtils.log('SOAP Client creation failed.')
messenger.jobError(sessionID, jobID, true, Errors.CLIENT_CREATE_ERROR)
return
}
Basic communication is fine. My main problem is that post create all the function calls I make on this client should be treated like they are coming from same soap client so that cpp server can serve them on right session. Any suggestion how to mimic the client support provided by cpp-soap api's

Azure App Service WebJob httpclient getasync request returning 500 internal server error

I have a webjob that is triggered by storage queued and makes a web api call when a new message is received. I tested the get request in fiddler and it works, but gets 500 internal server error when the request is made via httpclient getasync within the webjob. Can a call to a web api be made within a webjob?
I tested the get request in fiddler and it works, but gets 500 internal server error when the request is made via httpclient getasync within the webjob.
As far as I know, the 500 internal server error is thrown by your Web API server-side. Please try to wrap your code with try-catch in your Web API application and find the detailed error.
Can a call to a web api be made within a webjob?
You could send http requests within the WebJob. Here is my code sample which could work well both on my side and Azure, you could refer to it.
Functions.cs
// This function will get triggered/executed when a new message is written
// on an Azure Queue called queue.
public static async void ProcessQueueMessage([QueueTrigger("queue")] string message, TextWriter log)
{
log.WriteLine(message);
string requestUrl = "https://bruce-chen-001.azurewebsites.net/api/values";
HttpClient client = new HttpClient();
var response = await client.GetAsync(requestUrl);
log.WriteLine("responseļ¼š{0}", await response.Content.ReadAsStringAsync());
}
Result
responseļ¼š["value1","value2"]

Call soap web service using HttpWebRequest in Windows Store Apps

Let me clear one thing that i don't wanna use "Add Service Reference" method. I want to call a soap service using HttpWebRequest in windows store app. I have working soap web service given by my client. I only have access to the web service but not source code. I have searched the internet but couldn't find solution for Windows store app.
Thanks in advance and Happy New Year.
Why do you want to avoid using Add Service Reference? Even so, I strongly discourage you from using HttpWebRequest directly as you will lose all the benefits of having the SOAP protocol already implemented.
You can use ChannelFactory<T>, though; even from a Windows Store app:
First create the interface from the web service WSDL using svcutil.exe:
svcutil /serviceContract http://localhost:61547/Service1.svc?wsdl
Include the generated code file in your Windows Store project.
Create the channel and call a method on it from your code:
var binding = new BasicHttpBinding();
var endpoint = new EndpointAddress("http://localhost:61547/Service1.svc");
var factory = new ChannelFactory<IService1>(binding, endpoint);
var channel = factory.CreateChannel();
var result = channel.GetData(3);
((IClientChannel)channel).Close();
I tried it out with a sample web service and it worked flawlessly.

Setting up a HTTP Receiver in Tibco Businessworks for an existing Web Service

So currently I managed to reach an existant Web Service and use one of it's functions to alter a database.
However, the Web Service does not respond with a Soap Response, but with just the HTTP Respond Code 200, which I want to use to create a "Success!"-like notification.
Using BusinessWorks I was able to to connect the process with a HTTP Receiver in the Modeler-View, but it doesn't work and gives me the error message
"Process configuration error. The activity [HTTPReceiver] in the process [webservices.module.IWSContract] cannot have an input transition."
My goal is to catch the HTTP Response Code 200 from the Web Service, and optionally display it to the user.
As you mention you use TIBCO BW 6. this should be the "Invoke" activity instead of SOAPRequestreply (Basic Palette -> Invoke)
You need to use a SOAP Request-Reply activity to invoke the web service. Technically, the "HTTP 200" response won't be visible but you will get an empty output in case of a success:
You can then choose to return whatever success message to the user.

Can a wcf client handle 2 version of a SOAP response from the same url?

I imported a service reference to a SOAP web service from the customer and coded my client based on that.
After going to production, they said they will launch a new version of the web service with changes to the output type of one of the requests I make to the service (among new messages that I don't consume).
I know I can update my service reference and update my client code to process the updated wsdl and launch an update to my client at the same time the web service updates.
But, is it possible to instrument the WCF code in some way so that I can handle both versions of the response without having to coordinate the update of my client with the update of the web service?
In most cases, NO. It depends on what has changes in the service interface? In most cases you'll need (and want) to upgrade your client. You can always ask them to support more versions of their interfaces.