CrmSvcUtil.exe throwing a 401 unauthorized error - dynamics-crm-2011

I have a crm 2011 instance running on a box that is joined to a domain.
I'm trying to run crmsvcutil from outside the domain using the following.
CrmSvcUtil.exe /out:Xrm.cs /url:http://crm.mydomain.com/MSCRMDEV/XRMServices/2011/OrganizationData.svc/ /domain:MYDOMAIN /u:mydomain\username /p:mypassword /namespace:Xrm /serviceContextName:XrmServiceContext
This generates the following error
CrmSvcUtil.exe Error: 0 : Exiting program with exit code 2 due to exception : System.InvalidOperationException: Metadata contains a reference that cannot be resolved: 'http://crm.mydomain.com/XRMServices/2011/OrganizationData.svc/?wsdl'. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Description.MetadataExchangeClient.MetadataLocationRetriever.DownloadMetadata(TimeoutHelper timeoutHelper)
at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper)
--- End of inner exception stack trace ---
at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper)
at System.ServiceModel.Description.MetadataExchangeClient.ResolveNext(ResolveCallState resolveCallState)
at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(MetadataRetriever retriever)
at Microsoft.Xrm.Sdk.Client.ServiceMetadataUtility.RetrieveServiceEndpointMetadata(Type contractType, Uri serviceUri, Boolean checkForSecondary)
at Microsoft.Xrm.Sdk.Client.ServiceConfiguration1..ctor(Uri serviceUri, Boolean checkForSecondary)
at Microsoft.Xrm.Sdk.Client.ServiceConfiguration1..ctor(Uri serviceUri)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceConfiguration.AdjustServiceEndpoint(Uri serviceUri)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceConfiguration..ctor(Uri serviceUri)
at Microsoft.Xrm.Sdk.Client.ServiceConfigurationFactory.CreateConfiguration[TService](Uri serviceUri)
at Microsoft.Crm.Services.Utility.SdkMetadataProviderService.CreateOrganizationServiceEndpoint()
at Microsoft.Crm.Services.Utility.SdkMetadataProviderService.Microsoft.Crm.Services.Utility.IMetadataProviderService.LoadMetadata()
at Microsoft.Crm.Services.Utility.CrmSvcUtil.Run()
at Microsoft.Crm.Services.Utility.CrmSvcUtil.Main(String[] args)
The trace from Fiddler
HTTP/1.1 401 Unauthorized
Cache-Control: private
Content-Length: 0
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
X-Powered-By: ASP.NET
Date: Mon, 06 Aug 2012 00:44:07 GMT
Proxy-Support: Session-Based-Authentication
No Proxy-Authenticate Header is present.
WWW-Authenticate Header is present: Negotiate
WWW-Authenticate Header is present: NTLM
The user/pass are that of a domain admin which is also a crm admin. What am I missing?
The interesting thing to note is that the URL in the error message does not contain the ORG name
'http://crm.mydomain.com/XRMServices/2011/OrganizationData.svc' <--- missing the org name here
from IIS logs I see a 401.5 which is "An ISAPI extension or CGI application denied the request":
2012-08-12 16:50:03 192.168.230.201 GET /MYORGNAME/XRMServices/2011/OrganizationData.svc wsdl+OnBeginRequest:08/12/2012-16:50:03.527+LogEntries:0+SqlCalls:0+SqlCallsMs:0+GC:1+OnEndRequest:16:50:03.528 80 - 192.168.230.201 - 401 5 0 3
2012-08-12 16:50:03 192.168.230.201 GET /XRMServices/2011/OrganizationData.svc wsdl+OnBeginRequest:08/12/2012-16:50:03.538+LogEntries:0+SqlCalls:0+SqlCallsMs:0+GC:1+OnEndRequest:16:50:03.538 80 - 192.168.230.201 - 401 5 0 4

I think you can easily solve your problem by following these instructions : http://blog.thinketg.com/blog/ben-klopfer/strongly-typed-code-file-generation-with-crmsvcutilexe-for-crm-2011-ifd-configurations-code
Regards,
Kévin

Related

Connect to localhost from android studio

I'm trying to connect from my app that runs under android studio.
in the app i have base_url : http://192.168.10.224/xxxxx/public/
I connect in the browser of the virtual device and fins the page I want, so I know that the address is right.
I start the app and come to the loginpage.
I type my variables and press sign in.
And I get this in log:
2020-11-21 18:23:25.682 27502-27795/com.xxxxxx.user D/OkHttp: --> POST http://localhost/xxxxxx/public/api/user/oauth/token
2020-11-21 18:23:25.682 27502-27795/com.xxxxxx.user D/OkHttp: Content-Type: application/x-www-form-urlencoded
2020-11-21 18:23:25.704 27502-27795/com.xxxxxx.user D/OkHttp: <-- HTTP FAILED: java.net.ConnectException: Failed to connect to localhost/xxxxxx:80
Why can't I connect to localhost?
UPDATE: this is how I get in Android Studio
E/AAAA: device token : 123456789
E/AAAA: login: req: {"
password":"123456","
device_id":"123","
grant_type":"password","
device_token":"123456789","
device_type":"android","
client_secret":"111111111111","
client_id":"2","
username":"MYEMAIL"}
D/OkHttp: --> POST http://xxxxx/public/api/user/oauth/token
D/OkHttp: Content-Type: application/x-www-form-urlencoded
Content-Length: 350
D/OkHttp: password=123456&device_id=123&grant_type=password&device_token=123456789&device_type=android&client_secret=111111111111&client_id=2&username=MYEMAIL
--> END POST (350-byte body)
D/OkHttp: <-- 405 Method Not Allowed http://xxxxx/public/api/user/oauth/token (113ms)

Asana get /events

everyone!
I've got a problem with receiving data for request like "/events" (as described in https://asana.com/developers/api-reference/events). I sent GET request to https:/ /app.asana.com:443/api/1.0/events/ and got error 400 (bad request). For further information please see folowing details (token has been obfuscated)
Request:
GET /api/1.0/events/ HTTP/1.1
Authorization: Bearer 0/00000000000000000000000000000000
Host: app.asana.com
Response:
HTTP/1.1 400 Bad Request
Server: nginx
Date: Mon, 01 Feb 2016 10:01:43 GMT
Content-Type: application/json; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Asana-Content-String-Length: 215
Pragma: no-cache
Set-Cookie: TooBusyRedirectCount=0
Cache-Control: no-store
X-Asana-Preferred-Release-Revision: 20160130_055457_72a36bb0a264503a3e39ecea630b93bfff45340f
X-Robots-Tag: none
Response body:
d7
{"errors":[{"message":"resource: Missing input","help":"For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors"}]}
Could you please advice me a solution to solve the issue?
According to the error message, you are missing the resource input.
Please consult https://asana.com/developers/api-reference/events to see how to use this feature.

Unable to deploy new jhipster application to Cloud Foundry

I'm trying to deploy a new jhipster application to cloud foundry keep getting the error below. I didn't have any problems before. any ideas on what can be wrong?
Uploading segundo...
REQUEST: [2015-11-07T11:25:18-05:00]
PUT /v2/resource_match HTTP/1.1
Host: api.run.pivotal.io
Accept: application/json
Authorization: [PRIVATE DATA HIDDEN]
Content-Type: application/json
User-Agent: go-cli 6.13.0-e68ce0f / linux
null
RESPONSE: [2015-11-07T11:25:18-05:00]
HTTP/1.1 500 Internal Server Error
Content-Length: 99
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Date: Sat, 07 Nov 2015 16:27:21 GMT
Server: nginx
X-Cf-Requestid: 3d72ac61-69ac-414e-7d59-b7238a0adce0
X-Content-Type-Options: nosniff
X-Vcap-Request-Id: f700dd35-a26b-4790-7c29-8d60b95a8eb0::3092ce9d-2adf-4d18-a566-6506185e659f
{
"error_code": "UnknownError",
"description": "An unknown error occurred.",
"code": 10001
}
FAILED
Error uploading application.
Server error, status code: 500, error code: 10001, message: An unknown error occurred.
FAILED
Error uploading application.
Server error, status code: 500, error code: 10001, message: An unknown error occurred.
I confirm this is currently an open issue at https://github.com/jhipster/generator-jhipster/issues/2225
It could be a number of things. cf logs segundo --recent is your friend here.
Potentially, the problem is simply that CloudFoundry is having some sort of internal instability and trying again later will rectify the problem. I've had similar issues before that were resolved by waiting a bit.

WebDAV server using IIS: HTTP error 412

I'm setting up a WebDAV server in my Windows 7 desktop, using IIS 7.5. The aim is for a WebDAV client app in my Iphone to be able to access and sync a series of files in a given folder in the PC. It's all in my own home network, and I'll be the only one syncing files.
Anyway, I've set everything up, but here is something really odd:
If I create a file in my Iphone, and then sync it to the Windows desktop, and then delete it in my Iphone... it deletes the file in the Windows desktop the next time I sync, as it should.
But if I create a file in my PC, sync it to my Iphone, and then delete it in my Iphone, the next time I sync it won't delete the file in the PC. It will return the HTTP error code 412 (Precondition failed).
I have enabled tracing in IIS, and looking at the request headers, I don't see the WebDAV client sending any precondition. Here is what it says:
Data about the HTTP request:
SiteId 1
AppPoolId DefaultAppPool
ConnId 1610612964
RawConnId 0
RequestURL http://192.168.1.111:80/Notebooks/filename.txt
RequestVerb DELETE
Request headers:
Headers Connection: keep-alive
Content-Length: 0
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: es-es
Host: 192.168.1.111
If-Modified-Since: Wed, 07 Oct 2015 19:37:37 GMT
If-None-Match: "1ab8c9f371d11:0"
User-Agent: Notebooks 8.1.2 ( iPhone; iOS 8.4.1; es_ES)
And here is the only thing that the module says in its warning message:
ModuleName WebDAVModule
Notification 128
HttpStatus 412
HttpReason Precondition Failed
HttpSubStatus 0
ErrorCode 0
ConfigExceptionInfo
Notification EXECUTE_REQUEST_HANDLER
ErrorCode The operation was correctly completed. (0x0)
The above were the errors shown in IIS tracing. As for the regular Web server log:
192.168.1.230 - (my PC name) [07/Oct/2015:23:13:59 +0200] "PROPFIND /Notebooks/filename.txt HTTP/1.1" 207 509
192.168.1.230 - (my PC name) [07/Oct/2015:23:13:59 +0200] "DELETE /Notebooks/filename.txt HTTP/1.1" 412 1738
I have been in touch with the developer of the Iphone WebDAV client, and he says that, in his experience, this tends to suggests permission problems, but I have checked the permissions of the files in Windows, and they are fine. By this I mean that I check the files that I can delete from WebDAV, and then the ones that give me the 412 error... and both have identical permissions.
What else could it be?

HTTP GET request forbidden 403 error while using netcat

So, I have to get http://www.rssweather.com/wx/in/kanpur/wx.php with using netcat.
My code goes like this.
nc -v rssweather.com 80
GET http://www.rssweather.com/wx/in/kanpur/wx.php HTTP/1.0
GET http://www.rssweather.com/wx/in/kanpur/wx.php HTTP/1.1
Connection: close
And, the result-
HTTP/1.1 403 Forbidden
Date: Thu, 03 Sep 2015 12:41:08 GMT
Server: Apache
Connection: close
Content-Type: text/html
charset=iso-8859-1
You don't have permission to access /wx/in/kanpur/wx.php
on this server.
Is there any way to overcome this Forbidden 403 error? What am I doing wrong?
You've already connected to the webserver at rssweather.com so you must not specify the full URL in the GET request, just the path:
nc -v rssweather.com 80
GET /wx/in/kanpur/wx.php HTTP/1.0
<blank line with return>

Resources