Sending message from Application-Server to target application on Android device - url

How to know exactly what URL does the 3rd-party application-server try to access while sending message to a client-device via the GCM-server?
In "SendAllMessagesServlet.java"
(which can be found # android-sdks\extras\google\gcm\samples\gcm-demo-server\src\com\google\android\gcm\demo\server\SendAllMessagesServlet.java)
.....
// Error 500 ( Connection timed out) at the following line
Result result = sender.send(message, registrationId, 5);
.....
3rd-party app-server - Tomcat v7.0

The URL is in the Constants.java file as GCM_SEND_ENDPOINT
in the android\gcm\gcm-server libray
public static final String GCM_SEND_ENDPOINT =
"https://android.googleapis.com/gcm/send";
The error 500 is due to proxy settings.
Thank You

Related

Jenkins JNLP port exposes internal ip

We have configured our Jenkins server to use a fixed port and JNLP 4.
Our info sec team has flagged that if one were to open a web browser pointing at the JNLP port, the internal properties below are listed which includes the internal ip of the Jenkins server.
Jenkins-Agent-Protocols:
Jenkins-Version:
Jenkins-Session:
Client:
Server:
Remoting-Minimum-Version:
Is this information necessary? Is this something which can be suppressed?
From the source: https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/TcpSlaveAgentListener.java
It looks like there is no mechanism to turn it off, and according to the comments, it seems to be only for testing:
String header = new String(head, Charsets.US_ASCII);
if (header.startsWith("GET ")) {
// this looks like an HTTP client
respondHello(header,s);
return;
}
// otherwise assume this is AgentProtocol and start from the beginning
(...)
/**
* Respond to HTTP request with simple diagnostics.
* Primarily used to test the low-level connectivity.
*/
private void respondHello(String header, Socket s) throws IOException {
(...)
If infosec requires you to turn this off, you might need to open a support ticket with cloudbees.

Event log warning "URL for this request exceeds the configured maxUrlLength" despite request succeeding

On my IIS server, I'm getting a warning message logged in the server's Application Event Log on a particular variety of incoming HTTP request with a long URL. Despite the warning message, ASP.NET MVC does correctly handle the request and return the expected response back to the client.
The event log message warning message includes the following text:
Event code: 3005
Event message: An unhandled exception has occurred.
...
Process information:
Process name: w3wp.exe
....
Exception information:
Exception type: HttpException
Exception message: The length of the URL for this request exceeds the configured maxUrlLength value.
at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)
Additional property/value information for the event log warning message:
Source: ASP.NET 4.0.30319.0
Event ID: 1309
Again, in this case the incoming HTTP request is ultimately succeeding, so unlike similar questions my question here is not how to successfully increase the max URL length for incoming requests on my server.
Rather, my question is: Given that my request is succeeding, can I prevent this (apparently spurious) warning message from being logged to my Application event log (adding noise to the log that may obscure other, "real" warnings)?
More details
This behavior (long HTTP request succeeds; warning message written to application event log) is reproducible both on my local workstation PC running Windows 10 and IIS 10, and on my production server running Windows Server 2008 R2 and IIS 7.5.
The project is being built with target framework: .NET Framework 4.5.1. (Update: The error still reproduces after rebuilding my project to target .NET Framework 4.6.1.)
The URLs that trigger the warning message to be written are long URLs (approximately 500 characters in length) of the form (for example):
https://myserver.example.com:443/api/MyDataRequestRoute/1862241,2146171,1998613,1916341,2150391,2067889,749865,2167130,1861707,1914448,668472,2170269,2162087,2024193,1857969,1869304,2162128,1980539,992479,1347745,1958431,282062,1925128,2147391,2153550,1187318,2039442,441327,1298384,2153556,1526985,1893085,2144727,2144288,1582412,2142540,2170281,1183488,1865249,1348332,1322007,2170282,2170283,1750061,2098502,1915955,905164,1353083,2099151,1347806,2160403,2147200,1191371,1347921,1909967,2017687,2012831
The URL is mapped to an ASP.NET MVC Controller method of the form:
[HttpGet]
[Route("MyDataRequestRoute/{commaSeparatedPropertyIDs}", Name = "MyDataRequestRoute")]
public HttpResponseMessage MyDataRequestRoute(string csv)
{
string xmlResult = // Code to build result based on the specified csv...
return new HttpResponseMessage()
{
Content = new StringContent(xmlResult, Encoding.UTF8, "text/xml")
};
}
In order to get these long URLs working, I previously made a few configuration changes to my application and server, specifically:
Set an UrlSegmentMaxLength value of 32766 in the server's Windows registry, per this answer.
Set attributes of the httpRuntime element in my "Api" project's web.config file:
<httpRuntime targetFramework="4.5" maxRequestLength="131072" maxUrlLength="32766" maxQueryStringLength="32766" />
Set the maxAllowedContentLength attribute of the requestLimits element in the same web.config file:
<requestLimits maxAllowedContentLength="134217728" />

Graphstory and Neo4jphp

I have succesfully used neo4jphp library with graphenedb with this simple steps as per documentation (considering that graphenedb does not require https)
require('vendor/autoload.php'); // or your custom autoloader
// Connecting to a different port or host
$client = new Everyman\Neo4j\Client(url, port);
// Connecting using HTTP and Basic Auth
$client->getTransport()
->setAuth('username', 'password');
// Test connection to server
print_r($client->getServerInfo());
However, when trying to connect to a graphstory instance (of course they both work fine if I call the rest api from browser, the neo4j console works fine etc.) which requires https as follows
require('vendor/autoload.php'); // or your custom autoloader
// Connecting to a different port or host
$client = new Everyman\Neo4j\Client(url, port);
// Connecting using HTTPS and Basic Auth
$client->getTransport()
->useHttps()
->setAuth('username', 'password');
// Test connection to server
print_r($client->getServerInfo());
I get the following error. They should be identical, I can't get why.
Fatal error: Uncaught exception 'Everyman\Neo4j\Exception' with message 'Can't open connection to https://neo-54f500bf2cc7e-364459c455.do-stories.graphstory.com:7473/db/data/' in /Applications/XAMPP/xamppfiles/htdocs/graphene/vendor/everyman/neo4jphp/lib/Everyman/Neo4j/Transport/Curl.php:91
Stack trace:
#0 /Applications/XAMPP/xamppfiles/htdocs/graphene/vendor/everyman/neo4jphp/lib/Everyman/Neo4j/Transport.php(95): Everyman\Neo4j\Transport\Curl->makeRequest('GET', '/', NULL)
#1 /Applications/XAMPP/xamppfiles/htdocs/graphene/vendor/everyman/neo4jphp/lib/Everyman/Neo4j/Command.php(64): Everyman\Neo4j\Transport->get('/', NULL)
#2 /Applications/XAMPP/xamppfiles/htdocs/graphene/vendor/everyman/neo4jphp/lib/Everyman/Neo4j/Client.php(828): Everyman\Neo4j\Command->execute()
#3 /Applications/XAMPP/xamppfiles/htdocs/graphene/vendor/everyman/neo4jphp/lib/Everyman/Neo4j/Client.php(464): Everyman\Neo4j\Client->runCommand(Object(Everyman\Neo4j\Command\GetServerInfo))
#4 /Applications/XAMPP/xamppfiles/htdocs/graphene/story.php(20): Every in /Applications/XAMPP/xamppfiles/htdocs/graphene/vendor/everyman/neo4jphp/lib/Everyman/Neo4j/Transport/Curl.php on line 91
It seems to me that neo4jphp is not configuring the TLS part in the cURL request.
I fixed it by downloading the certificate bundle from http://curl.haxx.se/docs/caextract.html (ca_bundle.crt) and adding the following line to Everyman\Neo4j\Transport\Curl.php, function makeRequest:
$options[CURLOPT_CAINFO] = "your/path/to/ca-bundle.crt";
I've created an issue on GitHub for this: https://github.com/jadell/neo4jphp/issues/171
I'm the CTO/Lead Dev at Graph Story. Sorry to hear you're having troubles. I've actually just taken a look at your instance and things seem OK from the server side.
Without additional info it's hard to say if there's an issue with your sample connection code. Considering that you've used that same library to connect to GrapheneDB in the past, I think the chances an error in the sample code is low.
Based on the current state of your instance and on the exception thrown by Neo4jPHP, my guess is that port 7473 may be blocked on your network. You can confirm that with local tech support or by switching to a network where you know port 7473 is open and trying to connect again.

Why does this Grails download behave strangely?

I've written a Grails application that connects to S3 and streams a file back to the client. This has worked great so far, up until I've tried to use it to download a large (2GB) file. I see the following behaviour:
When starting the download normally by calling the controller, after around 1GB, the download 'completes'.
Opening multiple tabs to trigger several simultaneous downloads causes the downloads to 'complete' after a few MB, although the actual amount downloaded seems to be random each time. This can also be observed when performing simultaneous downloads on multiple machines.
In both cases, the error messages are the same:
errors.GrailsExceptionResolver SocketException occurred when processing request: [GET] /download
Connection reset.:
java.net.SocketException: Connection reset
errors.GrailsExceptionResolver IllegalStateException occurred when processing request: [GET] /download
getOutputStream() has already been called for this response.
Here's the part of the controller concerned with the download:
DownloadController.groovy
def index() {
def fileStream = s3Service.getStream()
response.setHeader("Content-disposition", "attachment;filename=foo.csv")
response.contentType = "text/csv"
response.outputStream = fileStream
response.outputStream.flush()
}
..and a snippet of the service that connects to S3 and gets the file:
S3Service.groovy
def getStream() {
def outputStream = ""
try {
AmazonS3 s3 = new AmazonS3Client()
S3Object object = s3.getObject(new GetObjectRequest('my-bucket-name', 'path/to/file.csv'))
outputStream = object.getObjectContent()
}
catch (AmazonServiceException ase) {
/* Log the error. Omitted for brevity. */
}
catch (AmazonClientException ase) {
/* Log the error. Omitted for brevity. */
}
return outputStream
}
I'm really stumped as to what's causing this.
It turns out that this error was occurring because the app is running on a server behind a load balancer, which is attempting to cache files that pass through it. It's unable to cache the larger files as it has limited disk space, and the download fails.
This was verified by connecting an instance of the app running locally to AWS, and observing that the strange behaviour no longer occurs.

The endpoint reference (EPR) for the Operation not found is

I have been struggling with the following error the last couple of
days can you please help!
I generated my server and client code using the wsdl2java tool from a
wsdl 2.0 file.
When invoking the webservice I am getting the following error:
org.apache.axis2.AxisFault: The endpoint reference (EPR) for the
Operation not found is
/axis2/services/MyService/authentication/?username=Denise345&password=xxxxx
and the WSA Action = null
My service is displayed on the axis2 webpage with all available methods.
Here is the output from TcpMon
==============
Listen Port: 8090
Target Host: 127.0.0.1
Target Port: 8080
==== Request ====
GET /axis2/services/MyService/authentication/?username=Denise345&password=xxxxx
HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
SOAPAction: ""
User-Agent: Axis2
Host: 127.0.0.1:8090
==== Response ====
HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: application/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 12 May 2011 15:53:20 GMT
Connection: close
12b
<soapenv:Reason xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Text xml:lang="en-US">The endpoint reference (EPR) for the
Operation not found is
/axis2/services/MyService/authentication/?username=Denise345&password=xxxxx
and the WSA Action = null</soapenv:Text></soapenv:Reason>
0
==============
I am using:
axis2-1.5.4
Tomcat 7.0.8
wsdl 2.0 file
Please help!
In my case it was caused by a wrong Content-Type in the HTTP POST. Setting it to text/xml solved the problem.
Try adding ?wsdl to the string.
As described by Eran Chinthaka at http://wso2.com/library/176/
If Axis2 engine cannot find a service and an operation for a message,
it immediately fails, sending a fault to the sender. If service not
found - "Service Not found EPR is " If
service found but not an operation- "Operation Not found EPR is and WSA Action = "
In your case the service is found but the operation not. The Axis2 engine uses SOAPAction in order to figure out the requested operation and, in your example, the SOAPAction is missing, therefore I would try to define the SOAPAction header
It happens because the source WSDL in each operation has not defined the SOAPAction value.
e.g.
<soap12:operation soapAction="" style="document"/>
His is important for axis server.
If you have created the service on netbeans or another, don't forget to set the value action on the tag #WebMethod
e.g. #WebMethod(action = "hello", operationName = "hello")
This will create the SOAPAction value by itself.
Action is null means that no Action in given SOAP Message (Request XML). You must set Action before SOAP call:
java.net.URL endpoint = new URL("<URL>"); //sets URL
MimeHeaders headers = message.getMimeHeaders(); // getting MIME Header
headers.addHeader("SOAPAction", "<SOAP Action>"); //add Action To Header
SOAPMessage response = soapConnection.call(<SOAPMessage>, endpoint); //then Call
soapConnection.close(); // then Close the connection
I had this same problem using curl to send a soap request. Solved it by adding "content-type: text/xml" to the http header.
I hope this helps someone.
This error is coming because while calling the service, it is not getting the WSDL file of your service.
Just check whether WSDL file of your service is there--> run server and from browser run axis 2 apps on local host and check the deployed services and click on your service, then it shows WSDL file of your service.....or check the service path in your client file.
I hope it may help you to resolve the problem.
This can be solved by disabling validation
<proxy>
<!-- . . . -->
<parameter name="disableOperationValidation">true</parameter>
</proxy>
Late answer but:
I see you do a GET - should be a POST ?
try removing the extra '/' after the operation name (authentication) when invoking through the client
/axis2/services/MyService/authentication?username=Denise345&password=xxxxx
It seems don't find wsdl file..
I've solved adding wsdlLocation parameter at javax.jws.WebService annotation
By removing cache wsdl-* files in /tmp folder, my problem was solved
see https://www.drupal.org/node/1132926#comment-6283348
be careful about permission to delete
I'm in ubuntu os
On Websphere Application Server, in the same situation, it helped deleting the Temp folders while the server was stopped.
I ran into the situation when the package of the service changed.
Open WSDL file and find:
<soap:operation soapAction="[actionNameIsHere]" style="document"/>
Add to the requests header [request send to service]:
'soapAction' : '[actionNameIsHere]'
This work for me.
For devs. using node-soap [ https://github.com/vpulim/node-soap ] - example:
var soap = require('soap');
var options = {
...your options...
forceSoap12Headers: true
}
soap.createClient(
wsdl, options,
function(err, client) {
if(err) {
return callBack(err, result);
}
client.addHttpHeader('soapAction', '[actionNameIsHere]');
...your code - request send...
});
I got this error because the SOAP request I was sending to the server was malformed and had an empty Body
In this case the error message from the server is misleading and can be solved changing the request content, without changing anything about operations, URLs, WSDL, etc

Resources