OData / lab

This repository is for exploring new ideas and developing early prototypes of various OData stacks.
Other
48 stars 59 forks source link

Unable to Connect #56

Open nla-brandonjames opened 6 years ago

nla-brandonjames commented 6 years ago

After I get the extension installed and expose the metadata to the public, the extension returns this when I try to add the connection. A detail about my connection is that we aren't currently using a valid SSL certificate. I can, however, pull the XML data up in a web browser.

Imgur

lalaqc commented 6 years ago

any news on this? I'm stuck with the same issue...

nla-brandonjames commented 6 years ago

I actually got in contact with the feedback contact for this extension, but he's telling me to get a valid SSL certificate for the endpoint. However, I don't see the validity in that because we're developers and not having a certificate for a server is part of the development process.

robsiera commented 6 years ago

try this: run Fiddler4 and allow https decryption. Then update your odata-services.

lalaqc commented 6 years ago

This works for me:

Use the OData v4 Client Code Generator extension instead. It says it only support to 2015 version but it work on 2017. The extension need a pre-release version of the OData.Client you can get at: https://www.myget.org/feed/odlnightly/package/nuget/Microsoft.OData.Client

To get through credentials, get the metadata from a browser from https://[your url]/odata/$metadata, save it in a local file with the edmx extension and set it as a source of the Code Generator.

Hope this help

nla-brandonjames commented 6 years ago

@lalaqc Saving it as as edmx file let it get to code generation, but I didn't download the solution in #51 yet. However, the web service I'm connected to is on OData v3. I get this error when performing those steps:

Severity    Code    Description Project File    Line    Suppression State
Warning     Running transformation: The element 'edmx:Edmx' was unexpected for the root element. The root element should be Edmx.
nla-brandonjames commented 6 years ago

After updating to version 0.3 (#63), I still get this error message.

siberianguy commented 6 years ago

Any update on this? I'm trying to access a public service (Cezanne, one of the biggest hr platforms). Worked smoothly in VS 2015 using WCF Connected Service but after upgrading to VS 2017 and installing OData Connected Service, I get an error "can not access https://serviceurl/$metadata".

AlanWong-MS commented 6 years ago

I had not come across this issue on my environment. Can you try these steps as a smoke test first?

If the above passes, then we can proceed to try to debug the issues on your particular environments. You will need to sync the source code. Then follow the information to debug here and here.

For starters, I would try putting a breakpoint at line 111 here.

Hope that helps!

edit: sorry accidentally clicked the close issue button.

siberianguy commented 6 years ago

@AlanWong-MS To be sure it has something to do with my environment, could you please try the service url that doesn't work for me: https://w3.cezanneondemand.com/CezanneOnDemand/v3/Dataservice.svc/

AlanWong-MS commented 6 years ago

@siberianguy the endpoint requires authentication and at the moment the project doesn't support it. We have this issue flagged as priority 1 and will be discussing it later this week.

siberianguy commented 6 years ago

@AlanWong-MS Yeah, I expected it to be related to authentication. Thank you for the update. Is it possible to give any estimation? It's blocking us from moving to .net core at the moment.

AlanWong-MS commented 6 years ago

@siberianguy at the moment, the discussion is scheduled for Friday. I'll keep this thread posted on updates. @nla-brandonjames does your endpoint also require authentication?

nla-brandonjames commented 6 years ago

@AlanWong-MS, it does (cookie authentication). However, SAP was able to include a configuration option where the endpoint is exposed. I performed this step.

Gabee01 commented 6 years ago

Hi. I was having the same problem trying to connect to SAP Service Layer, so I just forked the project and made a fix for it..

here you can get the modified source code

To use it, you can open the solution at this folder and run(debug) it (Uninstall any vesion you already have installed first).

nla-brandonjames commented 6 years ago

@Gabee01 When I install this, the Connected Services dialog doesn't list OData Connected Service any more for some reason. edit: Scratch that, I can't even build the extension from master and it show up. Do you mind posting the vsix file you installed in this thread?

nla-brandonjames commented 6 years ago

I was able to run the project and get it to list in the Connected Services dialog in the Debug instance of VS by cloning @robsiera 's repo and pasting the changes @Gabee01 made in PR #67. However, when I get to code generation, I get the same error as posted in #64. If Gabe was able to generate a vsix that generates the code for him, then maybe he has some different setup than I do. I included my SAP metadata if you want to test code generation with it. sap-metadata.zip

Gabee01 commented 6 years ago

@nla-brandonjames I used the debug instance of VS to create the class. After you do it, I don't think you need the extension anymore, you just use the generated connected service. Note that, even with the metadata exposed, you still have to login (I used postman for that) before trying to connect, otherwise you'll get an error. I didn't generate a .vsix file because I couldn't get the .vsix creator tool (don't remember the name) working.. that's why I used the debug instance.

Edit

And I did use VS2017 to debug the plugin and create the connected service class

nla-brandonjames commented 6 years ago

@Gabee01 You can still find the vsix file from the project's /bin/Debug folder. If it's not there do you mind testing the metadata I uploaded in the last post? Ha I'm in hot anticipation for this code generation to work. It means a lot to me to get connected to SAP WS.

Gabee01 commented 6 years ago

@nla-brandonjames I don't have access to change our SAP metadata.. and there's nothing on my /bin/Debug folder.. You said you got the debug running, so you should be able to debug the plugin while it's trying to create your class and see where/why it crashes.

nla-brandonjames commented 6 years ago

@Gabee01 You won't have to change the SAP metadata. I can't do that, either. All you'd need to do is target the edmx file by inputting its location on your hard drive when it asks for the address.

Gabee01 commented 6 years ago

@nla-brandonjames your metadata file is good. It generates the class as well

nla-brandonjames commented 6 years ago

@Gabee01 I appreciate you performing that test! Now I'm doing some debug snooping to find where the null issue is. Check my newest contribution to #64. I think I found the reported null value. Do you have a different version of VS than I do? I'm running the Community version.

Gabee01 commented 6 years ago

I'm using VS CE 2017 v15.3.2

nla-brandonjames commented 6 years ago

I'm on v15.3.4 that came out like 3 days ago but that shouldn't contribute to the issue should it?

nla-brandonjames commented 6 years ago

@Gabee01 Do you happen to have WCF Data Services installed on your computer?

AlanWong-MS commented 6 years ago

All,

We discussed this particular topic regarding setting up authentication in the extension during the meeting I mentioned earlier. As of this moment, we don't have resources to allocate to this item but we do have several parties asking for the feature. The discussion on how we want to approach this is spilling over into next week and I'll continue to provide updates wherever I can.

In the meantime, I encourage everyone to continue to support each other in the spirit of open source development. Thank you @Gabee01 for opening PR #67; much appreciated for your help in unblocking others. Having taken a look at the current iteration of the PR, I would recommend that it be used for test purposes only as it accepts all certificates for authentication. I'll provide feedback in the PR for alternative approaches.

siberianguy commented 6 years ago

@AlanWong-MS is there an update on this and related issues?

AlanWong-MS commented 6 years ago

@siberianguy, PR #67 is pending changes. We don't have resources allocated for support on this at this time, but it's in our backlog.

My statement regarding using the current proposed changes in #67 only in the test environment still stands. If you choose to pull the changes in the PR, please proceed with caution.

Gabee01 commented 6 years ago

I tried working on this today, but couldn't test what I've done. My guess is that @nla-brandonjames was right. I updated my VS several weeks ago, and it looks like oData Connected Service does not work on VS2017 v15.3.5 (or we're missing something). The connected service plugin is installed, but all I've got on the connected services screen is that no connected service is supported for the current project type (which is the same I was using before). Trying to debug the code, it did not show any errors or complaints, it's just not working. I made the changes specified on #67, but I can't test it, and I have no experience with .xaml, so I have no idea if the code is going to work. Can anyone with the same version (VS2017 v15.3.5) try to install and use the oData Connected Services plugin, just to be sure it isn't a local issue? If possible, try to debug the project as well.

kdcllc commented 6 years ago

@Gabee01, I was able to connection to http://services.odata.org/AdventureWorksV3/AdventureWorks.svc/ as an example with VS2017 v15.3.5 but we have secure point that requires us to pass header information. How can I do that?

AdamCaviness commented 6 years ago

We have been a user of the OData Client Code Generator v4 for a v4 OData service. We have no authentication on the $metadata path but we do have HTTPS. In our dev environments we must accept any certificate errors when updating the proxy generated classes. I wanted to give the Connected Service a go but get the same error as the OP.

Gabee01 commented 6 years ago

@kdcllc I think you could try getting the metadata using another tool which lets you provide the headers you need (like postman) and create an metadata file as @nla-brandonjames asked me to do for testing his metadata file (All you'd need to do is target the edmx file by inputting its location on your hard drive when it asks for the address.) EDIT: Not really sure if it works that way.. but would solve this issue EDIT2: Just tried it and it works in my case. If creating an .edmx file and referencing the path of this file as your endpoint address on the configuration works, please let us know, because I think this issue should be closed and then there's no need for #67.

nla-brandonjames commented 6 years ago

I've still been following this thread, and what I suggest is that the application detects the install of WCF services before generating the code the first time. If it isn't detected, show a message in a new view on the UI and a file browser button which lets you manually select the location. This, however, opens the possibility of a new error of the user selecting the incorrect folder. In this case, after the folder is selected, do a check for a certain file that would only be in WCF services and if it fails, don't allow the user selected folder be stored.

AlanWong-MS commented 6 years ago

Per @Gabee01's comment:

kdcllc I think you could try getting the metadata using another tool which lets you provide the headers you need (like postman) and create an metadata file as nla-brandonjames asked me to do for testing his metadata file (All you'd need to do is target the edmx file by inputting its location on your hard drive when it asks for the address.)

This has also been the workaround that I have been suggesting to other users on my end.

learntecno commented 6 years ago

Hi Everyone, Please help me , I got stuck, I am getting the below error. I am using Visual studio 2017 15.4.3 image

nla-brandonjames commented 6 years ago

Connected Services I found this on the post for the VS 2017 15.5 preview in the VS blog. Was this something you guys were working on? Does it pretty much integrate OData/Lab directly into VS instead of it being an extension?

albernazf commented 6 years ago

Navigate to the url /$metadata get the xml save on your PC and point to that file instead of the url, all it needs is the xml to generate all classes.

onyangofred commented 6 years ago

Just open the link in Internet explorer, will prompt for username and password. Then save the credentials. Try again in visual studio. It works!!!

bishtrial commented 6 years ago

Any update on this issue? @nla-brandonjames @AlanWong-MS

AlanWong-MS commented 6 years ago

Authentication has not been implemented yet in the extension. For now, please use one of the workarounds mentioned in the previous comments.

ManuelRivasRP commented 5 years ago

Hello, any solution found today for this problem? I would greatly appreciate your response.

AlanWong-MS commented 5 years ago

The state of the request remains the same at this time.

klacol commented 5 years ago

We can still not use OData within VS 2017 when the endpoint is secured. Has anyone a link to a easy working step-by-step tutorial that explains, how the workarounds mentioned by @AlanWong-MS can be used.

OzBob commented 5 years ago

@klacol did you try method suggested by @onyangofred ? Start | Run: iexplore

klacol commented 5 years ago

@klacol did you try method suggested by @onyangofred ? Start | Run: iexplore

Yes, but that did not work for me. I solved it manually for me in these steps:

  1. Download the OData Metadaten from the metadata: https://...myservicsvc/$metadata
  2. Save locally as : c:/{MyPath}/myService.xml
  3. Then add the Metadaten from c:/{MyPath}/myService.xml
  4. Than i ran into this issue and solved it with this fix.

Then it worked for me.

artemvalmus commented 5 years ago

@klacol This worked out for me also. Thanks!

unchase commented 5 years ago

You can try Unchase OData ConnectedService for solve this issue without fix registry. This service supports Network Credentials and proxy (with credentials) for connecting to the endpoint.

Suhut commented 4 years ago

You can try Unchase OData ConnectedService for solve this issue without fix registry. This service supports Network Credentials and proxy (with credentials) for connecting to the endpoint.

thx man

unchase commented 4 years ago

You can try Unchase OData ConnectedService for solve this issue without fix registry. This service supports Network Credentials and proxy (with credentials) for connecting to the endpoint.

thx man

You are welcome!

fclante commented 4 years ago

Navigate to the url /$metadata get the xml save on your PC and point to that file instead of the url, all it needs is the xml to generate all classes.

This did it for me! thanks @albernazf commented on Feb 6, 2018