How to disable scanning #WebService annotations in JBoss AS 7? - web-services

I have web services developed using Spring+ApacheCXF and I need tod eploy them on JBoss AS7.
They are being deployed by CXFServlet properly.
But JBoss AS7 also deploying them by scanning #WebService annotations(as expected without Spring Injection).
How to disable scanning #WebService annotations in JBoss AS 7?
PS: I am deploying as a .war file.
PS PS:
My current cxf webservices are being deployed properly. But JBoss AS7 also trying to scan #WebService classes and deploying them also(without dependencies injected).I am looking for a way to turn of JBossAS7's scanning for #WebService classes.

This applies for Jboss 6 as well. I tried it on my Jboss 6.2.2.
Comment the following in standalone.xml
<!-- <extension module="org.jboss.as.webservices"/> -->
Then comment the below snippet in the same standalone.xml. Note if you are using different profile name or in domain mode you will have to do it at similar places.
<!--
<subsystem xmlns="urn:jboss:domain:webservices:1.2">
<modify-wsdl-address>true</modify-wsdl-address>
<wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
<endpoint-config name="Standard-Endpoint-Config"/>
<endpoint-config name="Recording-Endpoint-Config">
<pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
<handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
</pre-handler-chain>
</endpoint-config>
<client-config name="Standard-Client-Config"/>
</subsystem>
-->

I believe you will want to remove this from your standalone.xml
<extension module="org.jboss.as.webservices"/>
and
<subsystem xmlns="urn:jboss:domain:webservices:1.1">
<modify-wsdl-address>true</modify-wsdl-address>
<wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
<endpoint-config name="Standard-Endpoint-Config"/>
<endpoint-config name="Recording-Endpoint-Config">
<pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
<handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
</pre-handler-chain>
</endpoint-config>
</subsystem>
This is what I did to remove the jboss webservices so I could use something else. I'm still in the middle of testing this but it is no longer deploying the services. I assume I will just be able to use spring to deploy. Hope this helps.

I am using exclude-filter in my application context XML file to exclude web service components from Spring component scan.
<context:component-scan base-package="your.application.base.package">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
<context:exclude-filter type="annotation" expression="javax.jws.WebService" />
</context:component-scan>
At the same time I include them in component scan in CXF context XML.

I'm using JBoss EAP 6.1 and i solved the same problem excluding the subsystems jaxrs and webservices.
jboss-deployment-structure.xml
<?xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclude-subsystems>
<subsystem name="jaxrs" />
<subsystem name="webservices" />
</exclude-subsystems>
<exclusions>
<module name="javaee.api" />
<module name="org.apache.log4j" />
</exclusions>
<dependencies>
<module meta-inf="export" name="com.liferay.portal">
<imports>
<include path="META-INF" />
</imports>
</module>
<module name="javax.mail.api" />
<module name="org.jboss.modules" />
</dependencies>
</deployment>
</jboss-deployment-structure>

Related

IIS django HttpPlatformHandler infinite loading

so i tried to do Http Platform Handler but now i am in an infinite loading screen when i visit localhost.
this is my configfile
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="PythonHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<httpPlatform processPath="C:\Python310\python.exe"
arguments="C:\inetpub\Comsroomform\Home manage.py runserver --port 80"
stdoutLogEnabled="true"
stdoutLogFile="c:\home\LogFiles\python.log"
startupTimeLimit="60"
processesPerApplication="16">
<environmentVariables>
<environmentVariable name="SERVER_PORT" value="80" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
and after a long while of loading this shows up
i was told to follow this tutorial: https://halfblood.pro/running-flask-web-apps-on-iis-with-httpplatformhandler/
You can refer to the following steps to host a Django web application using Httpplatformhandler.
For Django physical path is a path to manage.py of your application.
Download and Install Httpplatformhandler on IIS using Windows Platform
Installer. Or download from this link.
Django APP with Httpplatformhandler Add web.config where your Django
app is defined.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"
requireAccess="Script" />
</handlers>
<httpPlatform startupTimeLimit="10" startupRetryCount="10" stdoutLogEnabled="true"
processPath="C:\Users\user\AppData\Local\Programs\Python\Python36\python.exe"
arguments="manage.py runserver">
<environmentVariables>
<environmentVariable name="foo" value="bar"/>
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
HttpPlaform is handling the Python process. ProcessPath
is a physical path to python executable. Just like you provide python
path in a windows environment variable. To access the python
executable. Here you have to provide python.exe in processPath.
Arguments are the same argument you pass running any python web
application. For eg. python manage.py runserver where app.py to port
number all are arguments. In the above application, manage.py
runserver is passed to run Django application.
Add Permission to Django Application and Python folder where your
executable is present.
Open folder properties.
In Security click on Edit then click on Add
Enter object name as IIS AppPool<yourappname>
Click on the check name if its present click ok and allow permissions you wanted to give then apply it.
Run your application
For more information, please refer to this tutorial.

Deploying two different Django Applications on Windows Server in IIS

I am deploying two different Django applications on Windows 2012 in IIS. My first application is running but I can't seem to run my second application.
My question is how do I configure my FastCGI Settings if I have two PYTHONPATH and two DJANGO_SETTINGS_MODULE?
Do I put a semicolon every after values? For example:
NAME: DJANGO_SETTINGS_MODULE
VALUE: mysettings.settings;myothersettings.settings
NAME: PYTHONPATH
VALUE: C:\PythonApps\firstapp;C:\PythonApps\secondapp
Step 1) Web Server's FastCGI Settings - in your web server under FastCGI Settings create an application for each site you will be running. If you are using a venv be sure to point to your python.exe and wfastcgi.py file within that venv. For isntance, I have one that points to:
"C:\Apps\.virtualenv\[enviroment-name]\python.exe|C:\Apps\.virtualenv\[enviroment-name]\Lib\site-packages\wfastcgi.py"
And one that points to:
"C:\Python37\pytohn.exe|C:\Python37\Lib\site-packages\wfastcgi.py"
Step 2) Website's Handler Mappings - for each handler mapping, The Module with be FastCgiModule and the settings should mirror the application settings you created in step one. So one site should have an executable of:
"C:\Apps\.virtualenv\[enviroment-name]\python.exe|C:\Apps\.virtualenv\[enviroment-name]\Lib\site-packages\wfastcgi.py"
The other should be:
"C:\Python37\pytohn.exe|C:\Python37\Lib\site-packages\wfastcgi.py"
Step 3) Web.Config File - In the root of your django app, save a file like the one below. The web server handler should coincide with the application setting you are using. Down in application settings you can define your WSGI_HANDLER, PYTHONPATH, and DJANGO_SETTINGS_MODULE.
https://pypi.org/project/wfastcgi/
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="Python FastCGI"
path="*"
verb="*"
modules="FastCgiModule"
scriptProcessor="C:\python37\python.exe|C:\python37\Lib\site-packages\wfastcgi.py"
resourceType="Unspecified"
requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<!-- Required settings -->
<add key="WSGI_HANDLER" value="core.wsgi.application" />
<add key="PYTHONPATH" value="C:\apps\django\dash" />
<!-- Optional settings -->
<add key="DJANGO_SETTINGS_MODULE" value="core.settings.production" />
</appSettings>
</configuration>

There was and error downloading 'https://$metadata'. The request failed with http status 403: Forbidden - XAMARIN WEB REFERENCE WITH HTTPS

I managed to create a web service with self signed SSL through IIS. It's settings at first are set to Client Certificate to none and none required SSL. It is accessible by that time threw web browser and mobile web reference.
Web Browser
Xamarin Web Reference
But when I set the SSL settings to required, it is now forbidden in both. What am I missing in settings for SSL Configuration?
SSL Settings Thru IIS
Web Browser Forbidden Access
Xamarin Web Reference Forbidden Access
WebConfig
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="constring" providerName="System.Data.SqlClient" connectionString="Data Source = source;Initial Catalog = dbname; User ID = user; Password = pw" />
</connectionStrings>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation targetFramework="4.5" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding maxReceivedMessageSize="10485760" name="SecureHttpBinding">
<readerQuotas maxStringContentLength="10485760"></readerQuotas>
<security mode="Transport">
<transport clientCredentialType="None"></transport>
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
To access web service via HTTPS in web browser, I followed this link for creating temporary client certificate but I changed the step #5 to this command
makecert -sk MyKeyName -iv RootCaClientTest.pvk -n "CN=tempClientcert" -ic RootCaClientTest.cer -sr localmachine -ss my -sky exchange -pe
I changed the currentuser to localmachine and signature to exchange so that it will be in personal certificate store. When you access the site again, it will ask for client certificate and you can choose it to proceed.
For the main problem to access the service in visual studio xamarin via web reference (which is forbidden somehow).
I found this link to solve the forbidden problem. You can see the second post of (c)MarkoOkram for the solution.
"I am solved problem by saving web browser .wsdl and .xsd files on file system, change reference in those files to matching files. Than i succesfully add reference in visual studio to that file system .wsdl file." -(c) MarkoOkram
I downloaded the file WSDL and XSDs written in WSDL then retarget the filepath to their respective directories and it's done.
update: I also tried to import singleWSDL and it works without editing for xsd's

Sitecore Feature ActiveDirectory - adding AD domain to the domainManager doesn't work

I'm using Habitat Sitecore. It comes with a bunch of foundation and feature projects. One of the feature projects is Sitecore.Feature.ActiveDirectory.
I'm trying to configure domains from patch files. It is outlined by Kam in this blog.
In the /App_config/Include/Feature/Feature.ActiveDirectory.config, I added the following:
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<switchingProviders>
<membership>
<provider providerName="ad" storeFullNames="false" wildcard="*" domains="ad" />
</membership>
<roleManager>
<provider providerName="ad" storeFullNames="false" wildcard="*" domains="ad" />
</roleManager>
</switchingProviders>
<domainManager>
<domains>
<domain id="ad" type="Sitecore.Security.Domains.Domain, Sitecore.Kernel" patch:after="domain[#id='default']">
<param desc="name">$(id)</param>
<ensureAnonymousUser>false</ensureAnonymousUser>
<locallyManaged>false</locallyManaged>
<isDefault>false</isDefault>
</domain>
</domains>
</domainManager>
</sitecore>
</configuration>
However, I get the following Exception:
A domain specified in the Sitecore.Security.SwitchingRoleProvider provider/domain map could not be found. Domain name: ad
in
<add name="switcher" type="Sitecore.Security.SwitchingRoleProvider, Sitecore.Kernel" applicationName="sitecore" mappings="switchingProviders/roleManager" />
What am I doing wrong?
Domains must be added directly to to Domains.config, located in App_Config\Security. It is not able to be patched. Make it part of your build train.

Server Side Logging with Spring-WS

I have implemented a web services using JaxWS-Spring. I would like to log the XML being received. I have tried various attempts, among which to add the proper categories to my log4j.properties file and using interceptors. However I have always failed for one reason or another (logging seems to be ignored - adding interceptors to my application context gives other issues).
The following snippets from my project :
PS: I am using Spring 2.5.6
web.xml
<servlet>
<servlet-name>jaxws-servlet</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Mapping to redirect all requests from 'FaxWebService' to jaxws-servlet. -->
<servlet-mapping>
<servlet-name>jaxws-servlet</servlet-name>
<url-pattern>/FaxWebService</url-pattern>
</servlet-mapping>
applicationContext.xml
<!-- Bind the URL FaxWebService to our bean FaxWebService. -->
<wss:binding url="/FaxWebService">
<wss:service>
<ws:service bean="#faxWebService"/>
</wss:service>
</wss:binding>
<!-- Bean responsible of taking care of the webservice. -->
<bean id="faxWebService" class="com.connexo.icubeplus3.dispatcher.webservices.FaxWebService"
scope="singleton">
<property name="dummyMode" value="${fax.dummy.mode}"/>
</bean>
I doubt this has anything to do with Spring WS to be honest.
If you want to log the incoming messages in Spring WS, you want to raise the logging level for org.springframework.ws.client.MessageTracing.sent and org.springframework.ws.client.MessageTracing.received to TRACE. For example, in log4j config:
<logger name="org.springframework.ws.client.MessageTracing.sent">
<level value="TRACE" />
<appender-ref ref="stdout" />
</logger>
<logger name="org.springframework.ws.client.MessageTracing.received">
<level value="TRACE" />
<appender-ref ref="stdout" />
</logger>
You will have to write a handler to log it. There are various examples in the web, like http://docs.oracle.com/cd/E13222_01/wls/docs103/webserv_adv_rpc/handlers.html