How do I get Apache Chainsaw oeprating based on the following chainsaw-config.xml file? - apache-chainsaw

I have Apache chainsaw V. 2 : The following is the XML file in the java project that I'd like to monitor using Apache chainsaw .
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration >
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">
<plugin name="XMLSocketReceiver" class="org.apache.log4j.net.XMLSocketReceiver">
<param name="decoder" value="org.apache.log4j.xml.UtilLoggingXMLDecoder"/>
<param name="Port" value="4000"/>
<param name="threshold" value="ALL"/>
</plugin>
<root>
<priority value="debug"/>
</root>
</log4j:configuration>
The way I understand, you connect using a Chainsaw option? For eg., when I say "File" -> "Load Rmeote Log4J file", then I get this pop-up :

It looks like you're using the latest developer snapshot of Chainsaw, yes? If not, grab it here: http://people.apache.org/~sdeboy
The option you've selected allows you to read a java.util.logging XML-formatted log file available from a URL (http etc).
Since you want to send events from a java.util.logging configuration via a socket, you should instead use the File, Load Chainsaw configuration option, select 'Use a Chainsaw config' and browse to the Chainsaw XML config file you pasted above with the XMLSocketReceiver definition.

Related

Adding a header to a XML message in Synapse

Using Synapse 2.1, I am trying to transform an XML message with no header into a SOAP message with a header containing credentials to consume a web service. Something like this:
Synapse incoming message:
<SOAP-ENV:Envelope>
<SOAP-ENV:Body>
...TAGS...
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Synapse outgoing message:
<SOAP-ENV:Envelope>
<SOAP-ENV:Header>
<yta:Authentication>
<yta:UserName>srnm</yta:UserName>
<yta:Password>psswrd</yta:Password>
</yta:Authentication>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
...TAGS...
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
How could I configure Synapse to do it? I am successfully using a transform file to update the body of the message, but not to add a header to the output.
I tried using the header and property mediators in the configuration file, but I am not sure what is the way to go. Reading about the header mediator it says "At the moment set header only supports simple valued headers". Could this be the case?
Thanks
For the record, I ended up using a script mediator with an inline javascript script in the configuration file using the addHeader method. See below:
<script language="js">
<![CDATA[
var user = mc.getPayloadXML()..*::UserName.toString();
var psswd = mc.getPayloadXML()..*::Password.toString();
mc.addHeader(false, <yta:Authentication xmlns:yta="yta:namespace url"><yta:UserName>{user}</yta:UserName><yta:Password>{psswd}</yta:Password></yta:Authentication>);
]]>
</script>
You can use XSLT mediator to manipulate it. So add an XSLT transformation with required headers and it would add required headers. Or use Script mediator / Class mediator where you can manipulate message.
Please refer followings which will be useful.
http://wso2.org/forum/thread/10794
http://wso2.org/forum/thread/10843
If this xml structure is not needed.
you can use Http Headers you can use properties as below.
http://blog.thilinamb.com/2011/04/how-to-access-web-service-using-http.html
Looks like you want to secure the service. The easiest then, is to use username-token security. Go to the services dashboard in WSO2 ESB for your proxy service and secure it, using UT. Also see http://docs.wso2.org/wiki/display/ESB460/Sample+200%3A+Using+WS-Security+with+policy+attachments+for+proxy+services for a security sample

What is the XML format for an item for the Sitecore Webservice

I am trying to use the built in web service in Sitecore 6.5 (.../sitecore/shell/webservice/service.asmx)
There is PDF that describes the commands, but it does not specify the format for inserting/updating items. It claims one can simply use the format when doing a GetXml request, but I have found that not to be true from my testing.
I have tried a number of variations, both trying with an or just single fields as suggested by this blog, with no luck and unfortunately the webservice does not complain about the input, it always responds "OK" with no effect.
The full request (as what I am looking at now)
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<Save xmlns="http://sitecore.net/visual/">
<xml>
<sitecore>
<field itemid="{7CCE4419-E8BD-45F4-9B9C-625E220C59A1}"
fieldid="{3F4B20E9-36E6-4D45-A423-C86567373F82}"
language="en"
version="1">
<content>A title from service</content>
</field>
</sitecore>
</xml>
<databaseName>master</databaseName>
<credentials><!-- removed --></credentials>
</Save>
</soapenv:Body>
If anyone knows what the format is that would be great.
If you are using Sitecore 6.5 then you can use the Item Web API, this should give you access to everything you need via JSON REST services.
There was a great response from Kevin Obee with further links, but also have a read of the following:
Sitecore Item Web API and Json.Net Test Drive
New features in Sitecore 6.6 – Webinar
I normally write my own webservice if I want to do some modifications to Sitecore items and found it a much more flexible way because I mostly want at least just a bit more functionality then the standard webservice has to offer. But be aware that you cannot serialize the Sitecore.Data.Items.Item class so sending an Item object through Soap is not going to work.

Webservice .Net 4.0 publishing problems in IIS7

I cant get my Webservice published, it should be simple:
I create the app in the IIS,
place it as a 4.0 Classic .Net
I publish it from .Net Solution within VS2012 Right click and publish
on the Webservice project.
The files are placed and it should show by itself on the browser on the URL of the server specified.
But I stumbled upon the following problems:
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
So I've looked for It and found this two options:
Option 1:
http://www.banmanpro.com/support2/Requested_Content_Appears_to_be_Script.asp
This one says I should go to Integrated, instead of Classic App Pool. but it's like if I changed a problem for another because now it says:
HTTP Error 500.21 - Internal Server Error
Handler "WebServiceHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list
When I go to the web config see what is this error talking about I see no handler tag!
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings />
<connectionStrings />
<system.web>
<compilation targetFramework="4.0" />
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm"/>
<error statusCode="404" redirect="FileNotFound.htm"/>
</customErrors>
-->
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
</system.web>
<system.webServer>
<directoryBrowse enabled="true" />
</system.webServer>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
</configuration>
Should I add one? If so, how?
Option 2:
Script not served by static file handler on IIS7.5
Basically it says I shoud do a aspnet_regiis -i, but when I try
going to %windir%\Microsoft.NET\Framework\v4.0.30319
Even when the folder exists, There is no aspnet_regiis!!
I've only found the aspnet_regiis on the 2.0 Fwk =(
Is that normal?
The handler tag wasn't the answer, however, both options drove me to look for the missing aspnet_regiis of fwk 4.
There was no aspnet_regiis because the full fwk 4.0 wasn't actually installed on a first place.
I had installed on the server the Framework 4 Client Profile and the debugger, which isn't the full version. From now on, whenever I think I have fwk 4 installed, I'll check twice.
After installing it, on Framework 4.0 Classic Pipeline Mode (instead of Integrated) made it work just fine.
But Attention!
After installing the framework, IIS will change the default pipeline to 4.0, that means, if you had ongoing a web(site/service) on 2.0 it will automatically stop working. (It happened to me)

Spring and Jax-WS : where are xsd schema?

In spring file applicationConfig.xml, JAX-WS integration need some specific schemas.
I recently successfully use these declarations :
https://jax-ws.dev.java.net/spring/core.xsd
https jax-ws.dev.java.net/spring/servlet.xsd
[I must remove all url (except one) because it's my first question]
The file begins with those declarations :
<beans xmlns="http www.springframework.org/schema/beans"
xmlns:xsi="http www.w3.org/2001/XMLSchema-instance" xmlns:aop="http www.springframework.org/schema/aop"
xmlns:tx="http www.springframework.org/schema/tx" xmlns:context="http www.springframework.org/schema/context"
xmlns:ws="http jax-ws.dev.java.net/spring/core" xmlns:wss="http jax-ws.dev.java.net/spring/servlet"
xsi:schemaLocation="http www.springframework.org/schema/beans http www.springframework.org/schema/beans/spring-beans.xsd
http www.springframework.org/schema/aop http www.springframework.org/schema/aop/spring-aop.xsd
http www.springframework.org/schema/tx http www.springframework.org/schema/tx/spring-tx.xsd
http www.springframework.org/schema/context http www.springframework.org/schema/context/spring-context.xsd
http jax-ws.dev.java.net/spring/core https jax-ws.dev.java.net/spring/core.xsd
http jax-ws.dev.java.net/spring/servlet https jax-ws.dev.java.net/spring/servlet.xsd">
(...)
<ws:service id="myService" bean="#myWS" />
<wss:binding url="/services/myws" service="#myService" />
Now, a migration occurs for website jax-ws.dev.java.net. These files are not found and I have some errors under Tomcat and Eclipse :
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'https://jax-ws.dev.java.net/spring/core.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not .
Is there a solution or something to prevent this error ?
Thanks
Finaly I extract XSD from jaxws-spring-1.8.jar (lib for jax-ws to work with Spring).
I put these XSD under WEB-INF directory, just near applicationContext.xml.
I modify declaration of schema in this file with :
http://jax-ws.dev.java.net/spring/core classpath:spring-jax-ws-core.xsd
http://jax-ws.dev.java.net/spring/servlet classpath:spring-jax-ws-servlet.xsd
I have seen the solution here :
Spring schemaLocation fails when there is no internet connection
I suppose you're using maven for building? Try adding the dependency to the pom.xml
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.1-1</version>
</dependency>
If you're not using maven, make sure you have jax-ws libs on your classpath.
http://java.net/projects/jax-ws
You don't need to extract the XSD from the jaxws-spring jar.
You just need to make sure the URL you use corresponds to that in the META-INF/spring.schemas file in the jar
They are defined as follows:
http\://jax-ws.dev.java.net/spring/core.xsd=spring-jax-ws-core.xsd
http\://jax-ws.dev.java.net/spring/servlet.xsd=spring-jax-ws-servlet.xsd
http\://jax-ws.dev.java.net/spring/local-transport.xsd=spring-jax-ws-local-transport.xsd
Think you just need to replace https with http. E.g:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ws="http://jax-ws.dev.java.net/spring/core"
xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://jax-ws.dev.java.net/spring/core http://jax-ws.dev.java.net/spring/core.xsd
http://jax-ws.dev.java.net/spring/servlet http://jax-ws.dev.java.net/spring/servlet.xsd>
For more info on spring.schemas, see here

How to report progress of a web service on windows mobile client?

I have tried to implement progress reporting using a soap extension as described at the following links:
stackoverflow
codeproject
However, my "ProgressUpdate" method is not being called, and I believe that is because I haven't got an app.config file in my Windows Mobile project to tell the web service calls to be processed by the SOAP Extension. How can do it in Windows Mobile? This is the sample config file used in the article:
<?xmlversion="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<webServices>
<soapExtensionTypes> <add
type="SoapExtensionLib.ProgressExtension, SoapExtensionLib"
priority="1" group="High" />
</soapExtensionTypes>
</webServices>
</system.web>
</configuration>
I figured out how to do this by adding a custom attribute to the method inside the generated proxy class. The custom attribute is derived from SoapExtensionAttribute.
I got the information at MSDN
Problem now is that I have to remember to add the attribute back in if I refresh the web service reference..............