Error while connecting ONVIF Device Manager to Geovision PTZ camera - onvif

Error is : The content type text/html of the response message does not match the content type of binding (application/soa+xml; charsset=utf-8), if using custom encoder ,be sure that the IsContentTypeSupported method is implemented properly. the first 1024 bytes of response were:' .... N So on ......

SOAP expects XML back and not HTML, therefore you get the error.
In my experience, you get HTML instead of XML when there's an error on the camera and it sends back some kind of description of the error.
To be able to understand what's going on, you should install wireshark, sniff the traffic and check what the camera sends back.

Related

How to Use HTTP Receive GET Message in Orchestration?

I have set up a HTTP Receive (req-response) adapter and the message appears to be getting to the message box. When I create an orchestration using a direct bound logical port, I am getting the message but everything I have tried to read the message body has failed (using passthrough pipeline, XML pipeline with allow unrecognized files = true) but I get exceptions any time I try to use the incoming message (message assignments, sending the message to a custom module to try to read the part(s)).
Rather than go into details on exceptions, can anyone point to instructions on what the proper way to access/use the body of the HTTP Get messages within an orchestration? To explain what I am trying to do, I want to take the query string (body) and send it verbatim to another orchestration for processing, so I simply want to extract the body (query string) from the message.
For a GET request without a body you need to use the WCF-WebHttp adapter rather than the deprecated BTSHTTPReceive.dll
With the WCF-WebHttp you can use the Variable Mapping to populate message context properties with the URI parameters.
So the answer was to NOT use the HTTP adapter for GET requests. I did not realize the HTTP adapter has effectively been deprecated. For basic GET requests I had to switch to the WCF-WebHTTP adapter and make sure to include the property in the property schema and then make sure to set the schema in the variable mapping as the property schema, not the message type schema of the incoming message. I wish the Microsoft documentation was more clear that the HTTP adapter cannot be used for very basic GET requests in which a body is not provided in the request.

Wallet Pass auto update web service using aws api gateway

I am working on a web service to update Apple Wallet passes using AWS Lambda/API gateway/NodeJS. The Apple wallet hit the api to get update pass but each time I am getting following error:
encountered error: Received invalid pass data (The pass cannot be read because it isn’t valid.)
I have tried the same URL in the browser to get the pass. The pass is downloading every time and its opening a valid pass every time. But its not working when Apple wallet hit the URL. I have tried same URL in Postman it gives me base64 instead of binary data.
I have tried to achieve the same functionality with NodeJS and deployed on heroku, its working properly with Wallet(also gives binary in Postman). But I need to use AWS Lambda/API gateway/NodeJS.
I am not sure, if AWS changing something while delivering binary data.
Any help on this is appreciated.
I just experienced this and spent hours trying to diagnose what was happening.
For anyone using AWS API Gateway & Lambda for their PassKit web service endpoints, there's a major "gotcha" (at least as of the date of my response) with how API Gateway's logic determines whether it needs to convert a response from base64 ==> binary.
If you inspect the request headers from Apple Wallet / PassKit, you'll see that the Accept header is */*.
API Gateway apparently iterates through the items in the request Accept header and determines if there is a match with any of the Binary Media Types you've defined under Your API Name > Settings. It will use the first match it finds and then, as you'd hope, convert the base64 string (from Lambda) to binary.
Here's the crazy part -- if you define application/vnd.apple.pkpass as one of your "please convert to binary" media types, requests from Apple Wallet / PassKit will not work. Why? Well, AWS (for whatever reason...) hasn't programmed */* to match any type ... it will literally only match */*.
As a result, the Accept header's */* will not match with application/vnd.apple.pkpass and your base64-encoded .pkpass response (from Lambda) will not be converted to binary, causing PassKit to choke + report errors.
TL;DR -- there is some goofiness with AWS API Gateway. To return PassKit pass data successfully, you need to add */* (not application/vnd.apple.pkpass) under Your API Name > Settings > Binary Media Types.

HTTP Error 405.0 - Method Not Allowed while Form Post

I posted a request to payu server via form submit using angularjs now once payment is completed payu will return a response with hash.But when it hits my success page i get "HTTP Error 405.0 - Method Not Allowed".I found many solutions online but none of that solved my issue.What i understood is that static html do not allow post by default.But my staticFile in IIS is like below
Request Path : *
Module : StaticFileModule
Name : staticFile
Request Restriction >Verb > All Verbs & Access > Script & Invoke > Files and folders
My question now in how to allow POST method for html page.I am using angular and if i change my success url to other than mine it works fine.I think there is some changes to be made to the web config but i tried my best but failed.Any help would be much appreciated.Also lets assume that the page successfully redirects to my success page how to capture the response that payu sends me online.
Thanks in advance if more input is needed from my side kindly ask in reply.
It's not that HTML does not allow POST by default, it's that HTML does not handle POST, period. (Not even if the HTML file contains JavaScript.) POST sends data to a script that runs on your server, and the script has to be smart enough to know what to do with the data. HTML isn't that smart. The only thing your server can do with HTML is to send the HTML back to whatever is requesting it. You need a server-side script that knows how to parse payu's response, do something appropriate with the hash, and then generate some HTML to display in the user's browser.

File not supported error while uploading profile image file to IBM Connections using REST API

I'm trying to upload a jpeg file for profile image using the Profiles REST API to IBM Connections_v5.0. I however get an error message "The type of the photo file you provided is not supported".
I'm however able to upload the same file directly using the Connections UI interface directly. I'm setting the MIME type correctly as "image/jpeg".
Also tried with GIF and PNG images but get the same error message.
Any pointers would be very helpful.
I'm just using FF restclient addon to fire a REST call. So basically doing a PUT on /profiles/photo.do?key=....
Content-Type is set as "image/jpeg" and the payload consists of the image data in binary (base 64) encoded.
The payload should just be the binary of the image, there is no need to Base64 encode it.
You should refer to Adding a Profile Photo
You need to use a Key (great stackoverflow post here)
If you know the key for a user's profile you can do the following:
key — This is generated by Connections itself during the population
process. It is used to define the users profile within the context of
Profiles and provides Connections with the ability to associate
content with a user when the users LDAP information has been altered.
It provides a separation of identity and helps facilitate user content
synchronization for Connections.
Once you have a key, you make the following request
URL: https://profiles.enterprise.example.com/profiles/photo.do?key=
b559403a-9r32-2c81-c99w-ppq8bb69442
METHOD: PUT
CONTENT-TYPE: image/png
input the binary content on the stream
you should be able to use "image/jpeg", "image/jpg", "image/png" or "image/gif"
If you have an error after the PUT method, you should add the SystemOut.log lines which are relevant.

check XBMC with Arduino

A week ago I started a new project with my Arduino MEGA 2560 with Ethernet Shield. I'm able to send a WOL to my server but now I want to PING my XBMC server with the JSON-RPC command. With my Chrome browser I'm able to check the server with follwoing HTTP GET request:
http://192.168.5.34/jsonrpc?request={"jsonrpc": "2.0", "id": 1, "method": "JSONRPC.Ping"}
And as a result I get a clean PONG back from the XBMC server:
{"id":1,"jsonrpc":"2.0","result":"pong"}
Now I tried to do this with my Arduino with the following code that is embedded in a function:
EthernetClient client;
IPAddress server(192,168,5,34);
if (client.connect(server, 80))
{
Serial.println("Connecting to Client...");
client.print("GET /jsonrpc?request={%22jsonrpc%22:%20%222.0%22,%20%22id%22:%201,%20%22method%22:%20%22JSONRPC.Ping%22} HTTP/1.1\r\n");
client.print("Host: 192.168.5.34\r\n");
client.print("User-Agent: Mozilla/5.0\r\n");
client.print("Connection: close\r\n\r\n");
}
else
Serial.println("Client Connection Failed!");
With my Arduino a got following return:
HTTP/1.1 401 Unauthorized
Content-Length: 0
Connection: close
WWW-Authenticate: Basic realm=XBMC
Date: Fri, 06 Jun 2014 21:33:24 GMT
I can make a GET request to Google with my Arduino so it's really XBMC that for some reason does not accept my GET request. Anyone got an idea why? I used Wireshark to sniff the network data on the server and the request and return are present in Wireshark.
Is there maybe a way to login on the XBMC server by GET or POST?
Thanks for the help guys! :)
WWW-Authenticate: Basic realm=XBMC
This means that your server requested your user agent (Arduino in this case) to authenticate using basic access authentication.
Adding this line should do the trick:
client.print("Authorization: Basic xxxxxxxxxxxxxxxxxxxx\r\n");
where xxxxxxxxxxxxxxxxxxxx is Base64 encoded (more precisely RFC2045-MIME variant of Base64 is used, except not limited to 76 char/line) username and password. In order to obtain it, you can use Wireshark to capture this request header while sending request from your browser, or generate it:
Check in your XBMC settings (Settings > Services > Webserver) for the username/password. It is by default xbmc:xbmc.
Go to http://www.motobit.com/util/base64-decoder-encoder.asp and in the first textbox put your username and password using format: username:password, e.g. xbmc:xbmc. Select encode option, change Maximum characters per line: to some big value, e.g. 500 and press Convert the source data.
Copy the Base64 representation (for xbmc:xbmc it will be eGJtYzp4Ym1j and use it in your header, e.g.:
client.print("Authorization: Basic eGJtYzp4Ym1j\r\n");
You can also use https://github.com/adamvr/arduino-base64 library for the base64 encoding.
The reason why it works in your browser is that it may have already been authenticated.

Resources