I'm using JaxWs Metro project implementation and i'm using this tutorial to add Ws Security feature to my web services.
http://java.globinch.com/enterprise-java/web-services/jax-ws/secure-usernametoken-java-web-services-using-metro-wsit/
What i have understand is that to add a Ws Security to your web service.You must first generate manually the wsdl file then add WSIT configuration part to your web service then put that modified wsdl in your project and modify sun-jaxws.xml so that take care of your modified wsdl file(so that it will not generate a new one).
I think it's extremley difficult to do all that for all my web services.In addition,i'm using eclipse so there is no generating tool(like netbeans).
I want to know is there any simple solution ?
Related
I have a Service Client Library project which has its own
app.config
.
This project is referenced in my Web Application. The problem is My web application throws following exception
Could not find endpoint element with name 'HttpEndPoint' and contract 'ServiceLibReference1.IDalService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.
There is nothing wrong with the service. If i directly refer my service in the web application it works fine as client configurations get added to the web.config. But my requirement is to keep it in a separate library project.
The reason for the exception is service configurations are not added to the web.config. Should i always add them manually? Should not VS add corresponding configurations into web.config whenever a service library is referenced? or am i missing something ?
thanks
Service libraries are, by design, intended to be used by (potentially) multiple different applications. Therefore, they don't use the app.config file included in the template - they will use the config file (web/app) of the application that is referencing them. This promotes code reuse - if you have certain methods that you are always using across multiple applications, it's easier to put them in a separate class library assembly. One benefit of that design is that you only need to change the code in one place to make the change effective for all using applications.
So yes, you will always need to add the service configuration to the specific application configuration file. Unfortunately, VS does not know to do this.
I would like to generate proxy classes/code from a WSDL for IDL. So that I may communicate with a SOAP service.
Anyone know any tutorials or have any clue on how it can be done?
Try to use WseWsdl3 - see http://msdn.microsoft.com/en-us/library/aa529578.aspx .
If WseWsdl3.exe is unable to create the proxy class, there is still a way.
If you can run your service as a regular ASP.NET web application in IIS, it creates temporary ASP.NET files where the proxy class is nicely generated for you.
You can find it in folder:
C:\Windows\Microsoft.NET\Framework\vMAJOR.MINOR.BUILD\Temporary ASP.NET Files\YOUR_WEB_APP.
There are some subfolders with random names, go to most recent one and look something like "App_WebReferences.XXXX.0.cs".
I have an ASP.NET MVC3 project in .NET 4 which needs to act as a SOAP server to receive notifications from another website.
I have created web services before, but I don't know how to set up a way to receive these notifications where the WSDL is provided by the external website.
I know I can create a service and get that to produce its own WSDL, but I'm assuming there must be an easy way to add a service reference, and then create a service that uses the objects/methods generated by it.
How do I do this?
Thanks
You can use the svcutil tool from visual studio commands line, to create the required configuration and proxy files
I'm signed up, I've downloaded sample code, I've got a WSDL...and yet I have no idea how to get this stuff into my existing .Net application. The WSDL was in a zip file, not a URL so I can't just "Add Web Reference." I've run the wsdl tool from the .Net command prompt, and it made a nice class for me...yet dropping that into my web_reference folder doesn't give me any kind of instantiatable class.
I know I'm missing something stupid. Can someone point me in the right direction please?
The proper way to load the FedEx API WSDL file in Visual Studio 2010:
Open the Solution Explorer
Right click your project
Click 'Add Service Reference'
Click the 'Advanced...' button
Click the 'Add Web Reference...' button
Enter the exact path to the WSDL file for the specific FedEx web reference you're using. For example, I extracted mine to the root of my C:\ drive, so all I entered into the URL field was "C:\ShipService.wsdl" without quotes. If you leave quotes, it won't work.
When you hit go, Visual Studio should consume the wsdl into workable classes for you. Click Add Reference and enjoy!
Note: Make sure you read the FedEx documentation well - a lot of their services have gotchyas and implementation can be a nightmare. For example, their address validation service is consumed incorrectly and creates two-dimensional arrays in Reference.cs where they shouldn't exist - this is detailed in the documentation. Worse yet, the fact that they don't allow address validation on their dev environment isn't documented anywhere! Good luck!
Actually, you can just "Add Web Reference". Give the path to the URL.
OTOH, you should be doing all new web service development (even client development) using WCF. Microsoft now considers ASMX web services to be "legacy technology".
BTW, I just tried using their address validation service, and it won't work with .NET. Both ASMX and WCF clients will attempt to use the XML serializer to consume this service, and there is a bug there that prevents that service from being used.
Matt, the WSDL zip file has the WSDL and its associated transactions for that service. Unzip the file and then "Add the reference" to the WSDL in your code.
Try changing the namespace of the proxy class to that of your application. I currently use the proxy class with C# and it works in spite of FedEx's limited documentation and samples.
For IIS6 I can use the IIS helpers in Wix to install a web application like this:
<iis:WebAppPool
Id="AP_MyApp"
Name="My Application Pool"
Identity="networkService" />
<iis:WebApplication
Id="WA_MyApp"
Name="MyApp"
WebAppPool="AP_MyApp">
<iis:WebApplicationExtension
CheckPath="no"
Executable="[NETFRAMEWORK20INSTALLROOTDIR]aspnet_isapi.dll"
Verbs="GET,HEAD,POST"/>
</iis:WebApplication>
Unfortunately, this doesn't work for IIS7. We don't want to use the aspnet_isapi.dll mechanism, and instead want the integrated pipeline to handle the request routing. The app pool created by this script is in Classic mode not Integrated mode so none of the handlers get run correctly.
How can I correctly install an MVC app on IIS 7?
I personally recommend using AppCmd.exe (matthewthurlow's first bullet) because you don't have to count on the legacy management components being installed, or risk modifying the configuration XML manually.
If you are not comfortable with AppCmd, Mike Volodarsky has a great article on Getting Started with AppCmd.exe, and the Microsoft IIS Configuration Reference is excellent, offering UI, Code and AppCmd examples for modifying each of the configuration items (e.g. Application Pools ). The IIS7 Administration Pack also includes a Configuration Editor that allows you to generate AppCmd scripts from any existing configuration.
To integrate AppCmd into WiX, you need to create and schedule two custom actions for each command. There is general information in the WiX v3 manual documenting this procedure, and I've included a concrete example below.
First, you need to set up an immediate action to store the command line in a property:
<CustomAction
Id="CreateAppPool_Cmd"
Property="CreateAppPool"
Execute="immediate"
Value=""[WindowsFolder]system32\inetsrv\APPCMD.EXE" add apppool /name:"[APP_POOL_NAME]"" />
Next you set up a deferred action which references this property:
<CustomAction
Id="CreateAppPool"
BinaryKey="WixCA"
DllEntry="CAQuietExec"
Execute="deferred"
Return="ignore"
Impersonate="no"/>
And finally, you need to schedule these. The immediate action that sets the properties seem to work well after InstallFinalize, and the deferred action works after InstallFiles. I haven't got as far as figuring out rollback actions yet.
MapGuide Open Source does this method extensively; you can see the CA scheduling in our MapGuide.wxs file, and the CA definition in our IIS7.wxs file.
Thanks to #matthewthurlow, I was able to use the XML utils to achieve what I needed to do:
<util:XmlFile
Id="ModifyAppPoolPipelineType"
Action="setValue"
ElementPath="//configuration/system.applicationHost/applicationPools/add[\[]#name='My Application Pool'[\]]/#managedPipelineMode"
File="[WindowsFolder]System32\inetsrv\config\applicationHost.config"
Value="Integrated"/>
The rest of the actions do seem to work fine with IIS 7.
The IIS extensions for WIX don't support IIS7. The IIS team keep rewriting the metabase between versions. There are quite a few things that don't work, the lack of an integrated app pool amongst them.
Until the extensions get rewritten, you're left with three options:
Use build in custom actions to invoke appcmd.exe
Use XmlConfig to update applicationHost.config
Write your own custom actions
I've opted for the xmlconfig option at the moment as you can do this within a component and tie it to a feature.