Google webmaster tool detects errors in sitemap? - sitemap

I have a sitemap that looks like this :
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:geo="http://www.google.com/geo/schemas/sitemap/1.0">
<url>
<loc>http://www.MyApp.se</loc>
<lastmod>2012-06-29</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
<url>
<loc>http://www.MyApp.se/Ad/Edit</loc>
<lastmod>2012-06-29</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Site/Faq</loc>
<lastmod>2012-06-29</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Site/Support</loc>
<lastmod>2012-06-29</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Site/AboutMyApp</loc>
<lastmod>2012-06-29</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Site/News</loc>
<lastmod>2012-06-29</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Site/Cookies</loc>
<lastmod>2012-06-29</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
</url>
<url>
<loc>http://www.MyApp.se/Ad/Detail?id=283</loc>
<lastmod>2012-06-26</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Ad/Detail?id=284</loc>
<lastmod>2012-06-26</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Ad/Detail?id=285</loc>
<lastmod>2012-06-26</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Ad/Detail?id=286</loc>
<lastmod>2012-06-26</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Ad/Detail?id=294</loc>
<lastmod>2012-06-28</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
</urlset>
And this is my Robo.txt :
User-agent: *
Disallow:
Sitemap: <http://www.MyApp.se/Site/Sitemap/>
The problem is that in Google Webmaster tool I get the following errors :
1
Warning
Invalid XML-tagg
This tag could not be identifyed.
**Problems :** 6
Tag: url
**Row :** 7
Tag: url
13
Tag: url
**Row :** 19
2
Warning
Webadress blocked by robots.txt.
Sitemap contains webadresses that is blocked by robots.txt.
**Problems :** 12
Value : http://www.MySite.se
Value: http://www.MySite.se/Ad/Detail?id=283
Value: http://www.MySite.se/Ad/Detail?id=284
Why? I have constructed the sitemap according to guides on internet?

OK, the <url> tags are all over the place. Everything from the opening <loc> tag to the closing </priority> tag for each website page must be enclosed within a set of <url> tags. See amended code below:
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>http://www.MyApp.se</loc>
<lastmod>2012-06-29</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>http://www.MyApp.se/Ad/Edit</loc>
<lastmod>2012-06-29</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Site/Faq</loc>
<lastmod>2012-06-29</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Site/Support</loc>
<lastmod>2012-06-29</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Site/AboutMyApp</loc>
<lastmod>2012-06-29</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Site/News</loc>
<lastmod>2012-06-29</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Site/Cookies</loc>
<lastmod>2012-06-29</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Ad/Detail?id=283</loc>
<lastmod>2012-06-26</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Ad/Detail?id=284</loc>
<lastmod>2012-06-26</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Ad/Detail?id=285</loc>
<lastmod>2012-06-26</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Ad/Detail?id=286</loc>
<lastmod>2012-06-26</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.MyApp.se/Ad/Detail?id=294</loc>
<lastmod>2012-06-28</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
</urlset>
Just to tidy up your robots.txt file, make it look as below. Make sure the Sitemap declaration links to the location of your sitemap.xml file:
User-agent: *
Sitemap: http://point-this-to-your-sitemap.xml
There's also no need for an empty Disallow declaration.
This is the basic structure I follow for the websites that I develop, so it should be fine!

Looking at the beginning of your file, you seems to have a problem with XML tags, you seem to have forgotten a after the first bloc. You have :
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:geo="http://www.google.com/geo/schemas/sitemap/1.0">
<url>
<loc>http://www.MyApp.se</loc>
<lastmod>2012-06-29</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
<url>
<loc>http://www.MyApp.se/Ad/Edit</loc>
[...]
And you should have :
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:geo="http://www.google.com/geo/schemas/sitemap/1.0">
<url>
<loc>http://www.MyApp.se</loc>
<lastmod>2012-06-29</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>http://www.MyApp.se/Ad/Edit</loc>
[...]
I think you have the same problem somewhere else in your code. You could try to use an XML editor to verify.

Related

How to create a valid sitemap with ExpressionEngine?

I'm trying to create a sitemap using ExpressionEngine, but when I load the URL in a validator it comes up empty.
ExpressionEngine uses channels and entries to display content, so in order to create a valid sitemap I need to pull in those channel entries by using the {exp:channel:entries} and bringing in the content through the respective channel. The only information I've been able to find regarding creating a sitemap in EE is from a question asked a few years ago, where someone answered with a couple examples and a couple docs to look at (link to the Q&A); however, my sitemap code looks correct and some validators say there are no errors but this is only because the URL for the sitemap ONLY shows the opening and closing urlset tags and their required info and nothing else. The file size is 431B.
** I've also tried putting in their respective "channel=__" tag
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
{exp:channel:entries entry_id="1"}
<url>
<loc>{site_url}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>1.00</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/about/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/activities/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/blog/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/cabins/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/conservancy/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/events/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/get-involved/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/groups/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/lodges/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/lodging/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/restaurants/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/events/details/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/blog/category/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/blog/archive/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/events/details/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/golf/course/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>monthly</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/lodges/rooms/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>monthly</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/parks/restaurant/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
<loc>{site_url}/parks/promotions/{url_title}</loc>
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
{exp:channel:entries entry_id="{entry_id}"}
<url>
{parents field="rel_promo_to_park"}
<loc>{site_url}/parks/promotion-details/{url_title}/{parents:url_title}</loc>
{/parents}
<lastmod>{entry_date format='%Y-%m-%d'}</lastmod>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>
{/exp:channel:entries}
</urlset>
I'm looking to figure out a way to create a valid sitemap with ExpressionEngine without having to purchase an addon.
I was using entry_id when I needed to be using category_id. This simple change brought in all the urls I needed dynamically.

Have Syntax Highlighting in Markdown for Maven Site (Fluido)

I have tried the following in my Maven project:
Add a markdown file content.md with content
```java
int a = 4;
```
in src/main/site/markdown.
Write a site.xml with content
<?xml version="1.0" encoding="ISO-8859-1"?>
<project>
<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
<version>1.7</version>
</skin>
<body>
<menu name="Dokumentation">
<item name="Benutzerhandbuch" href="content.html" />
</menu>
<menu ref="reports" />
</body>
</project>
Write a pom.xml with
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.continentale.testsvn</groupId>
<artifactId>site-test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-module-xhtml</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-module-markdown</artifactId>
<version>1.8</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Now I get a file content.html from mvn site. In this file, the int a = 4 is not syntax highlighted.
What do I need to do to get syntax highlighting?
I couldn't get it to work with Maven either but I found a workaround: Do the highlighting client-side in Javascript with highligh.js.
Download highlight.js and place it under src/site/resources/highlightjs.pack.js, as well as a CSS theme, e.g. src/site/resources/styles/atom-one-light.css.
In your site descriptor:
<project>
<body>
<head>
<![CDATA[
<link rel="stylesheet" href="styles/foundation.css" />
<script src="highlight.pack.js"></script>
<script>
document.addEventListener('DOMContentLoaded', (event) => {
document.querySelectorAll('pre.source').forEach((block) => {
hljs.highlightBlock(block);
});
});
</script>
]]>
</head>
</body>
</project>
Maven generate <pre class="source" /> blocks for code blocks so we need to tell that to highlight.js. Unfortunately Maven doesn't put a class name corresponding to the language (Java in your example) but highlight.js auto-detects languages and that works in most cases.

feign.RetryableException: Read timed out executing GET http://forex-service/currency-exchange/from/EUR/to/INR\r\n\tat feign.FeignException.errorExecu

I am following microservices code from : http://www.springboottutorial.com/microservices-with-spring-boot-part-5-eureka-naming-server and using latest version of Spring Boot and Spring Cloud as of now is 2.1.2.RELEASE and Greenwich.RC2.
When I hit the
curl -XGET http://localhost:8100/currency-converter-feign/from/EUR/to/INR/quantity/10000
I am getting below error.
{"timestamp":"2019-01-21T16:48:19.250+0000","status":500,"error":"Internal Server Error","message":"Read timed out executing GET http://forex-service/currency-exchange/from/EUR/to/INR","trace":"feign.RetryableException: Read timed out executing GET http://forex-service/currency-exchange/from/EUR/to/INR\r\n\tat feign.FeignException.errorExecuting(FeignException.java:84)\r\n\tat feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:113)\r\n\tat feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:78)\r\n\tat feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103)\r\n\tat com.sun.proxy.$Proxy84.retrieveExchangeValue(Unknown Source)\r\n\tat com.prateek.currencyconversion.CurrencyConversionController.convertCurrencyFeign(CurrencyConversionController.java:47)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:498)\r\n\tat org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189)\r\n\tat org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)\r\n\tat org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)\r\n\tat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)\r\n\tat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800)\r\n\tat org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)\r\n\tat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)\r\n\tat org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)\r\n\tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)\r\n\tat org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:634)\r\n\tat org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:741)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\r\n\tat org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\r\n\tat org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\r\n\tat org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\r\n\tat org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\r\n\tat org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\r\n\tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)\r\n\tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)\r\n\tat org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)\r\n\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)\r\n\tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)\r\n\tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)\r\n\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)\r\n\tat org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)\r\n\tat org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)\r\n\tat org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)\r\n\tat org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417)\r\n\tat org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\r\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\r\n\tat org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)\r\n\tat java.lang.Thread.run(Thread.java:748)\r\nCaused by: java.net.SocketTimeoutException: Read timed out\r\n\tat java.net.SocketInputStream.socketRead0(Native Method)\r\n\tat java.net.SocketInputStream.socketRead(SocketInputStream.java:116)\r\n\tat java.net.SocketInputStream.read(SocketInputStream.java:171)\r\n\tat java.net.SocketInputStream.read(SocketInputStream.java:141)\r\n\tat java.io.BufferedInputStream.fill(BufferedInputStream.java:246)\r\n\tat java.io.BufferedInputStream.read1(BufferedInputStream.java:286)\r\n\tat java.io.BufferedInputStream.read(BufferedInputStream.java:345)\r\n\tat sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:735)\r\n\tat sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)\r\n\tat sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1587)\r\n\tat sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)\r\n\tat java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)\r\n\tat feign.Client$Default.convertResponse(Client.java:143)\r\n\tat feign.Client$Default.execute(Client.java:68)\r\n\tat org.springframework.cloud.openfeign.ribbon.FeignLoadBalancer.execute(FeignLoadBalancer.java:90)\r\n\tat org.springframework.cloud.openfeign.ribbon.FeignLoadBalancer.execute(FeignLoadBalancer.java:56)\r\n\tat com.netflix.client.AbstractLoadBalancerAwareClient$1.call(AbstractLoadBalancerAwareClient.java:104)\r\n\tat com.netflix.loadbalancer.reactive.LoadBalancerCommand$3$1.call(LoadBalancerCommand.java:303)\r\n\tat com.netflix.loadbalancer.reactive.LoadBalancerCommand$3$1.call(LoadBalancerCommand.java:287)\r\n\tat rx.internal.util.ScalarSynchronousObservable$3.call(ScalarSynchronousObservable.java:231)\r\n\tat rx.internal.util.ScalarSynchronousObservable$3.call(ScalarSynchronousObservable.java:228)\r\n\tat rx.Observable.unsafeSubscribe(Observable.java:10327)\r\n\tat rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.drain(OnSubscribeConcatMap.java:286)\r\n\tat rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.onNext(OnSubscribeCo100 10754 0 10754 0 0 2397 0 --:--:-- 0:00:04 --:--:-- 25201.call(LoadBalancerCommand.java:185)\r\n\tat com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180)\r\n\tat rx.Observable.unsafeSubscribe(Observable.java:10327)\r\n\tat rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94)\r\n\tat rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42)\r\n\tat rx.Observable.unsafeSubscribe(Observable.java:10327)\r\n\tat rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber$1.call(OperatorRetryWithPredicate.java:127)\r\n\tat rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.enqueue(TrampolineScheduler.java:73)\r\n\tat rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.schedule(TrampolineScheduler.java:52)\r\n\tat rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:79)\r\n\tat rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:45)\r\n\tat rx.internal.util.ScalarSynchronousObservable$WeakSingleProducer.request(ScalarSynchronousObservable.java:276)\r\n\tat rx.Subscriber.setProducer(Subscriber.java:209)\r\n\tat rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:138)\r\n\tat rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:129)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)\r\n\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)\r\n\tat rx.Observable.subscribe(Observable.java:10423)\r\n\tat rx.Observable.subscribe(Observable.java:10390)\r\n\tat rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:443)\r\n\tat rx.observables.BlockingObservable.single(BlockingObservable.java:340)\r\n\tat com.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:112)\r\n\tat org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:65)\r\n\tat feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:108)\r\n\t... 58 more\r\n","path":"/currency-converter-feign/from/EUR/to/INR/quantity/10000"}
I am not sure how this is working fine now by adding below changes.
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

Spring reactive Rest xml payload

I am sending the request through postman to try the rest payload with spring reactive programming
Controller
#RestController
public class WBController {
#PostMapping(value="/transform", consumes="application/xml", produces="application/xml")
#ResponseBody
public Mono<Extractdata> tranformTechnicalMetadata(Mono<Extractdata> data) {
return data;
}
POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gateway</groupId>
<artifactId>rest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>com-microservice</name>
<description>reactive Project</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web-reactive</artifactId>
<version>5.0.0.M4</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>io.projectreactor.ipc</groupId>
<artifactId>reactor-netty</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.12</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
Pojo Class
i
mport java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
#XmlRootElement(name="extractdata")
#XmlAccessorType(XmlAccessType.FIELD)
public class Extractdata {
#XmlElement(name="inputName")
private String inputName;
#XmlElement(name="inputValue")
private String inputValue;
public String getInputName() {
return inputName;
}
public void setInputName(String inputName) {
this.inputName = inputName;
}
public String getInputValue() {
return inputValue;
}
public void setInputValue(String inputValue) {
this.inputValue = inputValue;
}
}
Sample Request
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<extractdata>
<inputName>ship</inputName>
<inputValue>TURNE</inputValue>
</extractdata>
Response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<extractMetadataEx/>
Problem with response is not getting the full data. Pojo the inputName and inputvalue is null.
expected output
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<extractdata>
<inputName>ship</inputName>
<inputValue>TURNE</inputValue>
</extractdata>
Any help is highly appreciated.

How do I find elements in this hpricot object?

Given the hpricot xml at the bottom of this post, how would I select the "item" without having to use .each? Every single piece of documentation uses a variation of
#res.items.each do |item|
# do stuff
end
Which is pointless in this case because there is only ever one "item". Been tearing y hair out for the last ages trying to get this right.
Edited to add more information:
Ok so judging from the early comments, I'm missing the point somewhere so I'll provide more information.
I'm using a ruby gem called amazon-ecs to retrieve product information from Amazon. On the gem's site it is described as
A generic Ruby Amazon Product Advertising API (previously known as E-commerce REST API) using Hpricot. It uses Response and Element wrapper classes for easy access to the REST API XML output. It is generic, so you can extend Amazon::Ecs to support the other not-implemented operations easily; and the response object just wraps around Hpricot element object, instead of providing one-to-one object/attributes to XML elements map.
Now to be hones I don't really understand what that means but I suspect the bit about the wrapping Response object is what's making this difficult!
Basically, when I do this:
#res = Amazon::Ecs.item_lookup(ean, options_hash)
and then I print out "debug #res", I get what I have below.
Hope that helps!
End edit
Hpricot xml:
<Amazon::Ecs::Response:0xa4449cc #doc=#<Hpricot::Doc
{xmldecl "<?xml version=\"1.0\" ?>"}
{elem <itemlookupresponse xmlns="http://webservices.amazon.com/AWSECommerceService/2005-10-05">
{elem <operationrequest>
{elem <httpheaders>
{emptyelem <header name="UserAgent" value="Ruby">}
</HTTPHeaders>}
{elem <requestid> "b89bad91-f5a1-4daf-87f2-d309dded35d6" </RequestId>}
{elem <arguments>
{emptyelem <argument name="Operation" value="ItemLookup">}
{emptyelem <argument name="SearchIndex" value="Books">}
{emptyelem <argument name="Signature" value="dasdasdsadsadsafdfdsfsdsasadsadsd">}
{emptyelem <argument name="ItemId" value="9780307463746">}
{emptyelem <argument name="IdType" value="ISBN">}
{emptyelem <argument name="AWSAccessKeyId" value="sdasdsadsadsadsadsadd">}
{emptyelem <argument name="Timestamp" value="2011-02-17T15:08:09Z">}
{emptyelem <argument name="Service" value="AWSECommerceService">}
</Arguments>}
{elem <requestprocessingtime> "0.0252220000000000" </RequestProcessingTime>}
</OperationRequest>}
{elem <items>
{elem <request>
{elem <isvalid> "True" </IsValid>}
{elem <itemlookuprequest>
{elem <condition> "New" </Condition>}
{elem <deliverymethod> "Ship" </DeliveryMethod>}
{elem <idtype> "ISBN" </IdType>}
{elem <merchantid> "Amazon" </MerchantId>}
{elem <offerpage> "1" </OfferPage>}
{elem <itemid> "9780307463746" </ItemId>}
{elem <responsegroup> "Small" </ResponseGroup>}
{elem <reviewpage> "1" </ReviewPage>}
{elem <searchindex> "Books" </SearchIndex>}
</ItemLookupRequest>}
</Request>}
{elem <item>
{elem <asin> "0307463745" </ASIN>}
{elem <detailpageurl> "http://www.amazon.com/Rework-Jason-Fried/dp/0307463745%3FSubscriptionId%3DAKIAIV6GP6CJC3AINUUQ%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0307463745" </DetailPageURL>}
{elem <smallimage>
{elem <url> "http://ecx.images-amazon.com/images/I/41Qz6afdrLL._SL75_.jpg" </URL>}
{elem <height units="pixels"> "75" </Height>}
{elem <width units="pixels"> "50" </Width>}
</SmallImage>}
{elem <mediumimage>
{elem <url> "http://ecx.images-amazon.com/images/I/41Qz6afdrLL._SL160_.jpg" </URL>}
{elem <height units="pixels"> "160" </Height>}
{elem <width units="pixels"> "106" </Width>}
</MediumImage>} {elem <largeimage> {elem <url> "http://ecx.images-amazon.com/images/I/41Qz6afdrLL.jpg" </URL>} {elem <height units="pixels"> "500" </Height>} {elem <width units="pixels"> "331" </Width>} </LargeImage>} {elem <imagesets> {elem <imageset category="primary"> {elem <swatchimage> {elem <url> "http://ecx.images-amazon.com/images/I/41Qz6afdrLL._SL30_.jpg" </URL>} {elem <height units="pixels"> "30" </Height>} {elem <width units="pixels"> "20" </Width>} </SwatchImage>} {elem <smallimage> {elem <url> "http://ecx.images-amazon.com/images/I/41Qz6afdrLL._SL75_.jpg" </URL>} {elem <height units="pixels"> "75" </Height>} {elem <width units="pixels"> "50" </Width>} </SmallImage>} {elem <mediumimage> {elem <url> "http://ecx.images-amazon.com/images/I/41Qz6afdrLL._SL160_.jpg" </URL>} {elem <height units="pixels"> "160" </Height>} {elem <width units="pixels"> "106" </Width>} </MediumImage>} {elem <largeimage> {elem <url> "http://ecx.images-amazon.com/images/I/41Qz6afdrLL.jpg" </URL>} {elem <height units="pixels"> "500" </Height>} {elem <width units="pixels"> "331" </Width>} </LargeImage>} </ImageSet>} </ImageSets>}
{elem <itemattributes>
{elem <author> "Jason Fried" </Author>}
{elem <author> "David Heinemeier Hansson" </Author>}
{elem <manufacturer> "Crown Business" </Manufacturer>}
{elem <productgroup> "Book" </ProductGroup>}
{elem <title> "Rework" </Title>}
</ItemAttributes>}
</Item>}
</Items>}
</ItemLookupResponse>}
First, extract the Hpricot object from #res (from the docs).
doc = #res.doc
Then, you should be able to use the Hpricot object:
puts (doc/:item).inner_html
You could do something like this
item = (doc/:header).first
The above should get you the first header node in the XML document. Its not tested so I would give it some testing

Resources