Recent Notes
Displaying keyword search results 1 - 10
Created by Dr. Xi on March 21, 2013 19:47:46
Last update: March 22, 2013 12:30:27
It's normal practice to import types from an external xsd file in WSDL like this:
<wsdl:types> <xsd:schema xmlns:xsd="htt... When you use <dynamic-wsdl> and have Commons XMLSchema on the class path, Spring-WS inlines the xsd in the wsdl. But that doesn't happen when you use <static-wsdl> . You can define a SimpleXsdSchema bean to expose the xsd: <?xml version="1.0" encoding="UTF-8"?> <beans x... where the bean id "hello" should match the schemaLocation attribute in the WSDL (without the .xsd suffix). But note that the SimpleXsdSchema does not inline the xsd. It only makes the xsd available via an HTTP URL. Alternatively, you can simply put the xsd file under the content directory of the webapp (just link any CSS or JavaScript). Anyway, that's a lot of manual...
Created by Dr. Xi on March 21, 2013 20:29:14
Last update: March 22, 2013 08:58:08
Spring-WS documentation says you can use a Jaxb object as parameter or return type, provided that it is annotated with javax.xml.bind.annotation.XmlRootElement , or is an instance of javax.xml.bind.JAXBElement . But that's a lot easier said than done! For example, if sayHelloResponse is defined as:
<xs:element name="sayHelloResponse" type="tns:sayH... then the JAXB generated class is not annotated with XmlRootElement , therefore, unusable for Spring-WS. You have to define the type as: <xs:element name="sayHelloResponse"> <xs:compl... in order to generate a type annotated with XmlRootElement . But that is not always possible. Alternatively, you can use the Maven plugin maven-jaxb2-plugin with the jaxb2-basics-annotate plugin (yes, plugin inside plugin) to inject the XmlRootElement annotation into the generated JAXB class. This is the pom: <project xmlns="http://maven.apache.org/POM/4.0.0"... and the binding file: <?xml version="1.0" encoding="UTF-8" standalone="y......
Created by Dr. Xi on March 21, 2013 20:33:18
Last update: March 21, 2013 20:33:18
This is a jaxb binding file that generates java.util.Calendar for xs:dateTime :
<?xml version="1.0" encoding="UTF-8" standalone="y...
Created by Dr. Xi on March 07, 2013 20:26:23
Last update: March 07, 2013 20:26:23
Create a jax-ws web service with Spring, Apache CXF and Maven.
Create the pom.xml :
<project xmlns="http://maven.apache.org/POM/4.0.0"...
Create the web service interface ( src/main/java/jaxws/JaxwsHello.java ):
package jaxws;
import javax.jws.WebService;...
Implement the web service ( src/main/java/jaxws/JaxwsHelloImpl.java ):
package jaxws;
import javax.jws.WebService;...
Create src/main/webapp/WEB-INF/cxf-servlet.xml :
<?xml version="1.0" encoding="UTF-8"?>
<beans x...
Register the CXF servlet in src/main/webapp/WEB-INF/web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app...
Build:
mvn package
The resulting WAR file can be deployed to any servlet container (for example, Tomcat).
Created by Fang on January 04, 2013 09:02:44
Last update: January 04, 2013 09:02:44
This snippet sets system properties from Maven surefire test plugin. This is useful when you want to set logging (for example, log4j) properties based on Maven project properties.
Example that sets system property testlog.dir :
<plugins>
<plugin>
<groupId>org.apach...
Example log4j.xml that uses system property testlog.dir :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYP...
Created by Fang on January 04, 2013 08:00:37
Last update: January 04, 2013 08:00:37
This is a Maven POM that prints out some built-in project properties:
<project
xmlns="http://maven.apache.org/PO...
Output:
$ mvn validate
[INFO] Scanning for projects.....
Created by voodoo on September 25, 2012 19:33:02
Last update: September 25, 2012 19:33:02
This a step-by-step example of how to create the files for GNU automake. Put the C source file in directory src ( cat src/hello.c ):
#include <config.h> #include <stdio.h> ... Run autoscan to generate configure.scan . Rename configure.scan : mv configure.scan configure.ac Edit autoscan.ac . Update this line: AC_INIT([FULL-PACKAGE-NAME], [VERSION] , [BUG-REP... Add this line after AC_INIT : AM_INIT_AUTOMAKE([foreign -Wall -Werror]) Add this line before AC_OUTPUT : AC_CONFIG_FILES([Makefile src/Makefile]) Create file Makefile.am ( cat Makefile.am ): SUBDIRS = src Create file src/Makefile.am ( cat src/Makefile.am ): bin_PROGRAMS = hello hello_SOURCES = hello.c Run these commands: $ aclocal $ autoheader $ automake --add-miss... The file configure is generated after autoconf is run. Build with: $ ./configure $ make Create tarball for distribution with: $ make dist...
Created by magnum on September 11, 2012 12:38:00
Last update: September 11, 2012 12:38:00
From bind man page:
SYNOPSIS
#include <sys/types.h>
...
The bind call assigns an address and a port to a socket. That's it. There's no mention of client or server, so it can be used on a client socket or a server socket. But it's necessary for a server socket, otherwise clients do not know how to contact the server.
For a client socket, the call is optional. When a client connects to a server or sends a message for the first time, a dynamic port is assigned to the client if there's no port assigned to it. If a port is bind beforehand, there's no dynamic assignment.
Test code:
int print_sock_info(int sockfd) {
struct so...
Prints:
Local addr: 0.0.0.0, port: 0
Local addr: 0.0.0....
Created by Dr. Xi on August 13, 2012 14:54:44
Last update: August 13, 2012 14:54:44
According to wikipedia , only two characters are invalid in a file name:
In Unix-like file systems the null character, as that is the end-of-string indicator and the path separator / are prohibited.
Created by voodoo on August 03, 2012 08:42:38
Last update: August 03, 2012 09:31:25
The C function getsockopt lets you get the error codes with the option SO_ERROR . The possible error numbers are defined in the global errno.h . The relevant values are:
#define ETIMEDOUT 110 /* Connection timed out */
...
But here's the whole list on my Linux system ( /usr/include/asm-generic/errno.h ):
#ifndef _ASM_GENERIC_ERRNO_H
#define _ASM_GENER...