Unable to create an azure cloud service using REST API - api

I am trying to create an Azure Cloud service using the REST API in a C# application. the XML used to describe the service is:
<CreateHostedService xmlns="http://schemas.microsoft.com/windowsazure">
<ServiceName>AppHostingCloudService</ServiceName>
<Label>base64-encoded-label-of-cloud-service</Label>
<Description>This cloud service will host VMs</Description>
<Location>Western-Europe</Location>
</CreateHostedService>
I did set up all headers correctly using the right certificate and all, I get an HTTP 400 error that says Bad Request, here is the details of the error:
+ response {StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Date: Thu, 31 Jul 2014 15:49:45 GMT
Server: Microsoft-HTTPAPI/2.0
Content-Length: 220
Content-Type: application/xml; charset=utf-8
}} System.Net.Http.HttpResponseMessage
Any ideas,
Thanks

400 Error usually means something wrong with the XML you're sending. Most likely it is the name of the datacenter location. You may want to get the list of locations by performing List Locations operation and see the right location name for Western Europe data center.

Related

Communication between 2 API services on the same cluster not working

I'm running a Kubernetes cluster with 2 API services inside Upon makin a API call to to my web-API located in the cluster I want the call to be forwarded to my backend-API.
This is not happening!
Now I looked into the the Ingress config of the backend-API and found its "Out side address" so to say and tried using that when forwarding API calls from the web-API upon which I received this message (This was a https address.
THE API CALL RESPONSE WAS: StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.0, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
Server: squid/3.1.23
Mime-Version: 1.0
Date: Fri, 22 Oct 2021 23:00:54 GMT
X-Squid-Error: ERR_DNS_FAIL 0
Content-Type: text/html
Content-Length: 3525
}
Then I did some reading and got convinced I should send the internal API call to the backend using its internal IP. So executed in to the container running the backend service and viewed the resolv.config file and here I found 2 things one was a name: which was followed by a IP address and the other was Search: which was followed by 3 very long names.
So I used the IP address that came after name and upon sending a API call to it I got the following response:
http://10.233.0.3/uploadBlob
THE API CALL RESPONSE WAS: StatusCode: 403, ReasonPhrase: 'Forbidden', Version: 1.0, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
Server: squid/3.1.23
Mime-Version: 1.0
Date: Sun, 24 Oct 2021 15:59:51 GMT
X-Squid-Error: ERR_ACCESS_DENIED 0
X-Cache: MISS from **************
X-Cache-Lookup: NONE from **************:8080
Via: 1.0 ************* (squid/3.1.23)
Connection: keep-alive
Content-Type: text/html
Content-Length: 3458
}
http://10.233.0.3/uploadBlob
OBS - I had to remove the addresses for security reasons as I am not the owner of it.
Now I'm all out of ideas as to how I can make this internal call between these two services and i would appreciate any help I could get.

Delete a S3 file using WSO2 ESB S3 connector

I am running into issues while trying to delete a file that resides in Amazon S3 using the WSO2 ESB connector. Here is what I have done:
1) Created a proxy service in WSO2 ESB using the following taken from the WSO2 documentation :
2) I made sure that the proxy service is deployed to WSO2 then using POSTMAN
3) I submitted the following to POSTMAN:
<deleteObject>
<accessKeyId>MYACCESSKEY</accessKeyId>
<secretAccessKey>MYSECRETKEY</secretAccessKey>
<methodType>DELETE</methodType>
<contentType>application/xml</contentType>
<expect>100-continue</expect>
<region>us-east-1</region>
<host>s3.amazonaws.com</host>
<bucketUrl>http://s3.amazonaws.com/MYBUCKET</bucketUrl>
<bucketName>MYBUCKET</bucketName>
<isXAmzDate>true</isXAmzDate>
<objectName>FILETODELETE.txt</objectName>
<versionId></versionId>
</deleteObject>
I get the following error message (beginning of message):
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
<AWSAccessKeyId>MYACCESSKEY</AWSAccessKeyId>
<StringToSign>AWS4-HMAC-SHA256
Sat, 07 Jul 2018 15:25:18 GMT
20180707/us-east-1/s3/aws4_request
618b0c822492e3dd2a8f4d9e1ea</StringToSign> <SignatureProvided>06b2b268cb90b69a1c5dadbb689ed4ccf7b459ff1b5</SignatureProvided>
<StringToSignBytes>BUNCH OF NUMBERS</StringToSignBytes>
<CanonicalRequest>DELETE
/MYBUCKET/xxxxx.txt/
content-type:application/xml
host:s3.amazonaws.com
x-amz-content-sha256:UNSIGNED-PAYLOAD
x-amz-date:Sat, 07 Jul 2018 15:25:18 GMT
content-type;host;x-amz-content-sha256;x-amz-date
UNSIGNED-PAYLOAD</CanonicalRequest>
<CanonicalRequestBytes>BUNCH OF NUMBERS</CanonicalRequestBytes>
<RequestId>SOODEDIBD</RequestId>
<HostId>vLllBSaWMHkV+gqX6yh7+43WK4PsAO4VVXLdGePBvGWZtxxExbBqI=</HostId>
I recreated my S3 credentials, but I am still running into the same error, any help will be greatly appreciated.
Frank
After going through delete object for S3, you need to check if the header values are going proper or not, as there is authentication required before accessing the web service , The header should look something like this .
DELETE /my-image.jpg?versionId=3HL4kqCxf3vjVBH40Nrjfkd HTTPS/1.1
Host: bucketName.s3.amazonaws.com
x-amz-mfa: 20899872 301749
Date: Wed, 28 Oct 2009 22:32:00 GMT
Authorization: AWS AKIAIOSFODNN7EXAMPLE:0RQf4/cRonhpaBX5sCYVf1bNRuU=
You can put wso2 esb on debug mode and confirm where proper header is being passed or not, else take a TCPDUMP to be accurate

RabbitMQ HTTP API call to aliveness-test returns 404 but other calls work

When using the HTTP API I am trying to make a call to the aliveness-test for monitoring purposes. At the moment I am testing using curl and the following command:
curl -i http://guest:guest#localhost:55672/api/aliveness-test/
And I get the following response:
HTTP/1.1 404 Object Not Found
Server: MochiWeb/1.1 WebMachine/1.9.0 (someone had painted it blue)
Date: Mon, 05 Nov 2012 17:18:58 GMT
Content-Type: text/html
Content-Length: 193
<HTML><HEAD><TITLE>404 Not Found</TITLE></HEAD><BODY><H1>Not Found</H1>The requested document was not found on this server.<P><HR><ADDRESS>mochiweb+webmachine web server</ADDRESS></BODY></HTML>
When making a request just to list the users or vhosts, the requests returns successfully:
$ curl -I http://guest:guest#localhost:55672/api/users
HTTP/1.1 200 OK
Server: MochiWeb/1.1 WebMachine/1.9.0 (someone had painted it blue)
Date: Mon, 05 Nov 2012 17:51:44 GMT
Content-Type: application/json
Content-Length: 11210
Cache-Control: no-cache
I'm using the latest stable version (2.8.7) of RabbitMQ and obviously have the management plugin installed for the API to work with the users call (the response is left out due to it containing company data but is just regular JSON as expected).
There isn't much on the internet about this call failing so I am wondering if anyone has seen this before?
Thanks,
Kristian
Turns out that the '/' at the beginning of the vhosts names is not implicit, even when as part of a URL. To get this to work I simply changed my request from:
curl -i http://guest:guest#localhost:55672/api/aliveness-test/
To
curl -i http://guest:guest#localhost:55672/api/aliveness-test/%2F
As %2F is '/' HTTP encoded, my request now queries the vhost named '/' and returns a 200 response which looks like:
{"status":"ok"}

BizTalk 2010 calling one way(fire and forget) service and acknowledgement

Context:
BizTalk 2010 trying to call a one way(fire and forget) PeopleSoft service that does not return a response. I have verified that BizTalk 2010 does not support one way services by design. Unable to call one way Peoplesoft service with WCF-Adapter from BizTalk 2010
PeopleSoft team showed me that their asynchronous service returns the following Http status and headers.
HTTP/1.1 200 OK
Date: Thu, 20 Jan 2011 15:31:37 GMT
Content-Length: 0
Content-Type: text/xml; charset=UTF-8
TransactionID: <some GUID>
X-Powered-By: Servlet/2.5 JSP/2.1
However, when I look at the xml returned from a One Way WCF service published by BizTalk 2010 I see this
HTTP/1.1 200 OK
Content-Length: 86
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.0
X-Powered-By: ASP.NET
Date: Thu, 20 Jan 2011 15:34:32 GMT
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body/></s:Envelope>
Note the empty SOAP message.
Therefore, BizTalk 2010 needs to have a NON-NULL response to be able to call a service.
PeopleSoft service sending back the HTTP status code above IS NOT considered an acknowledgement by BizTalk.
Is that correct?
Thanks.
If a web service does not return a response, it needs to return an HTTP 204 - No Content. I've not tried this in WCF yet, but HTTP honors the no content return code. As for the BizTalk WCF service... not sure why it's not using 204. But since it is using 200, it needs to send something.
It looks like BizTalk 2010 does need to have a NON-NULL response to be able to call a service.
Thanks to Ben for confirmation.
See details here.
What is the nature of the message you send out? You could in theory send a one way HTTP message and correlate on a separate HTTP response port.

Is it possible to log the first line of the response in apache?

We have an Tomcat server where we're trying to log the HTTP version which the response is sent with. We've seen a few times that it seems to be HTTP/0.9, which kills the content (not supported I guess?). We would like to get some stats on this by using the access log in apache. However, since the header line for this isn't prefixed by anything, we cannot use the %{xxx}o logging.
Is there a way to get this?
An example:
Response is:
HTTP/1.1 503 This application is not currently available
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Content-Length: 1090
Date: Wed, 12 May 2010 12:53:16 GMT
Connection: close
And we'd like the catch HTTP/1.1 (alternatively, HTTP/1.1 503 This application is not currently available.
Is this possible? We do not have access to the application being served, so we need to do this either as a Java filter, or in the tomcat access log - Preferably in the access log.
Enabling the <Valve className="org.apache.catalina.valves.RequestDumperValve"/> in server.xml writes out the request and response headers for each request.
Example:
19-May-2010 12:26:18 org.apache.catalina.valves.RequestDumperValve invoke
INFO: protocol=HTTP/1.1