Wednesday, July 11, 2012

Open ID simple-openid error

Hace tiempo quisimos probar OpenID. Si te bajas el codigo fuente de OpenID de 
http://code.google.com/p/openid4java/ y quieres ejecutar el ejemplo de simple-openid te dice que ejecutes este comando
 
mvn jetty:run en el directorio de simple-openid 
 
pero sale este maravilloso error 
 
[ERROR] Failed to execute goal on project simple-openid: Could not resolve dependencies for project org.openid4java:simple-openid:war:0.9.6: The following artifacts could not be resolved: org.openid4java:openid4java:jar:0.9.6, org.openid4java:openid4java-consumer:jar:0.9.6, org.openid4java:openid4java-server:jar:0.9.6, org.openid4java:openid4java-server-JdbcServerAssociationStore:jar:0.9.6, org.openid4java:openid4java-consumer-SampleConsumer:jar:0.9.6, org.openid4java:openid4java-server-SampleServer:jar:0.9.6: Failure to find org.openid4java:openid4java:jar:0.9.6 in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project simple-openid: Could not resolve dependencies for project org.openid4java:simple-openid:war:0.9.6: The following artifacts could not be resolved: org.openid4java:openid4java:jar:0.9.6, org.openid4java:openid4java-consumer:jar:0.9.6, org.openid4java:openid4java-server:jar:0.9.6, org.openid4java:openid4java-server-JdbcServerAssociationStore:jar:0.9.6, org.openid4java:openid4java-consumer-SampleConsumer:jar:0.9.6, org.openid4java:openid4java-server-SampleServer:jar:0.9.6: Failure to find org.openid4java:openid4java:jar:0.9.6 in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:196)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project org.openid4java:simple-openid:war:0.9.6: The following artifacts could not be resolved: org.openid4java:openid4java:jar:0.9.6, org.openid4java:openid4java-consumer:jar:0.9.6, org.openid4java:openid4java-server:jar:0.9.6, org.openid4java:openid4java-server-JdbcServerAssociationStore:jar:0.9.6, org.openid4java:openid4java-consumer-SampleConsumer:jar:0.9.6, org.openid4java:openid4java-server-SampleServer:jar:0.9.6: Failure 
Caused by: org.sonatype.aether.resolution.DependencyResolutionException: The following artifacts could not be resolved: org.openid4java:openid4java:jar:0.9.6, org.openid4java:openid4java-consumer:jar:0.9.6, org.openid4java:openid4java-server:jar:0.9.6, org.openid4java:openid4java-server-JdbcServerAssociationStore:jar:0.9.6, org.openid4java:openid4java-consumer-SampleConsumer:jar:0.9.6, org.openid4java:openid4java-server-SampleServer:jar:0.9.6: Failure to find org.openid4java:openid4java:jar:0.9.6 in 
 
Esto te dice que no encuentra las dependencias de los jar. 
Según leo por los blog esto se resuelve diciendo en el fichero de pom.xml que no ataque a los jar sino a los pom.
 
Según pone en esta entrada  
http://stackoverflow.com/questions/6542235/maven-could-not-resolve-dependencies-for-openid4java
 
Pero me sigue diciendo que no encuentra las librerias.
Así que si las quieres instalar en tu repositorio local solo tiene que ejecutar en la carpeta maven2 
 
mvn install
 
pero esto no te instalará las librerias ya que estan configurados como POM.
 
Así que en cada una de las carpetas maven2/ puedes cambiar los fichero pom.xml  el <type>pom</type> por   <type>jar</type>  menos de la principal 
No cambies  el fichero maven2/pom.xml
 
Esto si que te instalará las librerias en tu repositorio local y podrás volver a ejecutar 
 
mvn jetty:run en el directorio de simple-openid 

 

Friday, June 1, 2012

PHP wamp error to load dynamic library


I have an error when I try add extension in PHP with  library in WAMP or XAMPP.
PHP warning PHP status: unable to load dynamic library
No se puede encontrar el módulo especificador

Put enviroment path in windows the path to library but this not works. You must reboot the PC to load the service Wamp the path. 


All work fine.

the library are wsf.dll 

Tuesday, October 4, 2011

create a web service in java without server

Sometimes when create a Web service in java dont return data but there are not any error. This happenig because the classs interface and the implementation dont have the same annotations. Solution: copy exactily the same funtion interface.


Monday, October 3, 2011

Create a Web Service in java without tomcat or glassfish

It`s posible create a Web service without a server. With java JSE 6 it's easy.

Create a interface with a method
package mycountry.entreprise.myservice;

import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;

@WebService(name = "MyService",
        targetNamespace = "http://MyService.entreprise.country/",
        serviceName = "MyMethod")
public interface MyService {
   
    @WebResult(name="returnValue")
    public abstract String[] oneMethod(
            @WebParam(name="param1") String param1);

}


Create a implementation of interface


import javax.jws.WebMethod;
import javax.jws.WebService;

import javax.xml.ws.Endpoint;

@WebService(name = "MyService",
        targetNamespace = "http://MyService.entreprise.country/",
        serviceName = "MyServiceService")
public class MyServiceImpl implements MyService{
   public String[] oneMethod(String param1) {
String []data=  {"1","AA","1","01};
return data;
}

 @WebMethod(exclude = true)
    public static void main(String[] args) {

          Endpoint.publish(
             "http://localhost:8080/service/myservice",
             new MyServiceImpl ());

    }

}


and create a client for the web service

import javax.xml.namespace.QName;
import javax.xml.ws.Service;


public class Client {
  
    static QName serviceQName = new QName("http://MyService.entreprise.country/","MyServiceService");
    static Service myServiceService;
   
    public static void main(String[] args) {
      try {
          URL wsdlLocation= new URL("http://localhost:8080/service/myservice?WSDL");
          myServiceService=Service.create(wsdlLocation, serviceQName);
         
          Cliente client = new Cliente();
          client.doTest(args);
       
      } catch(Exception e) {
         
        e.printStackTrace();
      }
   }
  
   public void doTest(String[] args) {
       System.out.println(    " Data recieve ... " + myServiceService);
      
       MyService myService=myServiceService.getPort(MyService.class);
      
       String[] listofdatas=  myService.oneMethod("send datas");

       System.out.println(" incoming data .. :"+ listofdatas.length);
   }
}


it's to easy...

Friday, September 9, 2011

javax.wsdl.WSDLException: no content-type: java.net.UnknownServiceException

Whe you read a WSDL from local disc, no error, but if you read a wsdl from a URL throw a exception that: 

Retrieving document at  WSDLException: faultCode=OTHER_ERROR: Unable to resolve imported document at 'http://localhost:8080/mifichero.wsdl'
no content-type: java.net.UnknownServiceException: no content-type

This error is fixed if change the  plugin reference javax.wsdl_1.5 by 
 javax.wsdl_1.6.2.v200806030405

Friday, May 27, 2011

Create a listener in your bussinnes process BPEL

When you´re execute a BPEL. I dont how debug a error. To see inside of a execution engenner you could implement a listener  


import java.util.Properties;
import org.apache.ode.bpel.evt.BpelEvent;
import org.apache.ode.bpel.evt.EventContext;
import org.apache.ode.bpel.iapi.*;

public class Listener implements  BpelEventListener {
   
    EventContext context;
   
    @Override
    public void onEvent(BpelEvent arg0) {
        context =arg0.eventContext;
        // TODO Auto-generated method stub
        String evento ="";
        evento = evento+ "--------------------------------\n";
        evento = evento+ "evento: ["+arg0.eventName(arg0)+"] \n";       
        evento = evento+ "linea : ["+arg0.getLineNo()+"] \n";
        evento = evento+ "tipo  : ["+arg0.getType()+"] \n";
        evento = evento+ getNamesVariables();
        evento = evento+ "--------------------------------\n";
        System.out.println(evento );

    }

    @Override
    public void shutdown() {
        // TODO Auto-generated method stub
        ;
        System.out.println( "-------------shutdown---------------\n");
       
    }

    @Override
    public void startup(Properties arg0) {
        String evento ="";
        // TODO Auto-generated method stub
        evento = evento+ "--------------------------------\n";
        evento = evento+ arg0 ;
        evento = evento+ "--------------------------------\n";
        System.out.println(evento );

    }
    private String getNamesVariables(){
        String cadena="";
        for(String variable :context.getVariableNames()){
            cadena = cadena +" variable["+ variable+"]\n";
        }
        return cadena ;
    }

}


build a class and copy  inside folder
apache-tomcat-5.5.33\webapps\ode\WEB-INF\classes

if  you dont create a file in  ode-axis2.properties you to have to create in
apache-tomcat-5.5.33\webapps\ode\WEB-INF\conf

this information are in http://ode.apache.org/ode-execution-events.html

Thursday, May 12, 2011

ejecutar la funcion doXslTrasnsform

Si quieres hacer transformacion de datos en el BPEL, existe una funcion que ejecuta las hojas de estilo XSLT, para ejecutar esta instruccion dentro de un BPEL necesita la ruta de un XSLT y un node-set. Este node-set no puede ser ni un tipo de dato definido en tu XML Schema, (fichero xsd) ni un mensaje WSDL. Así que lo unico que acepta son elementos definidos. Así que es un poco extraño que si en tu WSDL que no has definido nigún tipo de dato element, tengas que definirlo para realizar una llamada a un XSLT. Así que la solución que propongo es, defines un nuevo fichero Schema XML inserto un element en el fichero, importo el Schema XML en el WSDL, importo el WSDL en el BPEL.

  <import location="HelloWorld.wsdl"
     namespace="http://ode/bpel/unit-test.wsdl"
     importType="http://schemas.xmlsoap.org/wsdl/" />
< ... mas nodos bpel
 <variables>
     <variable name="myVar" messageType="test:HelloMessage"/>
     <variable name="tmpVar" element="data:elementoNuevo" />
     <.... mas variables
   </variables>
<... proceso
<... copia el mensaje a la variable.
   <bpel:assign  name="Assign">
            <bpel:copy>
                <bpel:from>bpel:doXslTransform('urn:/transforma.xsl',$tmpVar)</bpel:from>
                <bpel:to variable="otherVar" part="TestPart" />
            </bpel:copy>
        </bpel:assign>