노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.



Eclipse, Python Editor 설치, 그리고 Hello World



 

Marketplace에서 python을 검색, PyDev를 선택 설치







Interpreter설정


- path는 Python 설치 위치에 따라 다름





 

프로젝트 신규 생성 - PyDev Project 생성




신규 Module 추가



Package명과 Name을 입력 ( print_hello_world.py가 test package밑에 생성)


Module: Main을 선택



생성된 파일에서 수정하기

pass를 print('Hello World')로 변경하고


Ctrl + F11을 실행



'Web Tech. > Python' 카테고리의 다른 글

Python 예제  (0) 2017.07.04
Python, Web 보안 (기초)  (0) 2017.07.04
vagrant up, Authentication failure. Retrying 발생시  (0) 2017.05.16
빅데이타와 Python  (0) 2017.02.07
Python/파이썬 설치  (0) 2016.11.16
블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


이클립스(Eclipse)에 Gradle 프로젝트 생성


- Eclipse Version : Neon


1. Gradle Plugin 설치(Install) 하기


- Buildship Gradle Integration 1.0 , by the Eclipse Foundation



직접 다운로드 Gradle (for local installation) 

: https://gradle.org/gradle-download/ --> 인터넷 환경이 열악한 경우에..



2. Gradle 프로젝트 생성하기


http://qiita.com/grachro/items/d1ebad3857a794895426방법4


Eclipse 프로젝트가 배포하고있는 플러그인 때문에 Eclipse에서 사용하려면 가장 편리합니다.  생성 된 프로젝트의 구성은 gradle 명령으로 생성 한 경우와 거의 동일합니다





블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.



Web Service Client 만들기 ( 이클립스 )

부제 : SOAP Client over HTTPS




SOAP : Simple Object Access Protocol
HTTPS : secure Hyper Text Transport Protocol 

WSDL : Web Service Definition Language

 


 

임으로 Dynamic Web Project ( 또는 Java Project )프로젝트를 생성 후에 추가하는 방법

 

 


방법 1. 프로젝트에 Web Service Client를 WSDL URL을 통해서 추가


 :  New -> Web Service Client -> Service definition


 

 

위와 같은 방식은 https://blog.outsider.ne.kr/187 에서도 살펴 볼 수 있지만,

WSDL을 URL 형태로 접근해서 받아 오는 경우지만, 에러가 발생하는 경우가 있다. 

이때 발생하는 에러메시지:  (X) The service definition selected is invalid.



에러가 해결 되지를 않을때는 아래 2번 방법을 시도

 


 

방법 2. 프로젝트에 WSDL File 생성하고 내용을 추가


일단 WSDL파일과 필요한 XSD파일도 같이 생성하고 수정한다. 

 


WSDL 파일을 생성후에 브라우저(해당URL)에서 보이는 내용을 복사해서 해당 파일의 내용을 교체 한다.

  

그 다음으로는 WSDL파일을 통해서, Web Services -> Generate Client를 수행한다.

 

 

 

URL 주소 형식 예제 : 

https://api.google.com/GoogleSearch.wsdl ,

http://www.webservicex.com/globalweather.asmx?WSDL

 

 


방법 3. wsimport를 사용해서 wsdl url을 호출하여 생성하는 방법 (아래쪽 참조)






Web Service Client 실행 하기

 

 

1. 테스트 실행


생성시에 테스트단계까지 선택을 하면  TestClient.jsp가 생성이 된다.

아래와 같은 테스트 화면을 볼 수 있다.

 

 

 

Configure the SSLContext with a TrustManager that accepts any cert (see below)
Configure the SSLContext with an appropriate trust store that includes your cert
Add the cert for that site to the default java trust store.



2. 아래와 같은 에러 발생시

 

이때도 HTTPS 연결시에 아래와 같은 에러가 발생하는 경우가 있다.


- javax.net.ssl.SSLHandshakeException

- sun.security.validator.ValidatorException

- PKIX path building failed

-sun.security.provider.certpath.SunCertPathBuilderException

- unable to find valid certification path to requested target Message



원인.  Java client trying to access a server with a self-signed certificate.


http://stackoverflow.com/questions/9210514/unable-to-find-valid-certification-path-to-requested-target-error-even-after-c




해결.


1) Configure the SSLContext with a TrustManager that accepts any cert (see below)


 해당 답변내의 예제 처럼 접근을 모두 허용하는 방법



2) Configure the SSLContext with an appropriate trust store that includes your cert


실행시에 적절한 trust store를 포함하는 방법이 있고,



3) Add the cert for that site to the default java trust store.


keytool을 통해서 자바의 기본 truststore에 추가 하는 방법 (아래쪽에 참조글)


(윈도우 위치 : C:\Program Files\Java\jre1.8.0_73\lib\security\cacerts)

(윈도우는 수정시에 관리자 권한으로 )



http://stackoverflow.com/questions/1828775/how-to-handle-invalid-ssl-certificates-with-apache-httpclient


 


참조 할만한 내용의 사이트들

 


웹서비스 클라이언트 만들기


 

웹서비스란게 있다. 쉽게 말하면 이기종간의 통신을 위한 것이다. SOAP, WSDL, UDDI등을 이용해서 자바사에서 C#으로 만들어진 서비스에 요청을 보내도 응답을 받을 수 있다. 그 이념과 목표는 대단했지만 너무 복잡한 스펙덕분에 빛을 발휘 못하고 요즘은 그나마 지원하는 툴들이 많아져서 괜찮아진것 같지만 REST의 등장으로 인하여 아주 큰 주목을 받지 못하고 있는 듯 하다. 검색해 보면 웹서비스에 대한 많은 글들을 볼수가 있고 크게 뜨진 못했지만 웹서비스는 끝났다라고 말할수는 없는듯 하다. REST가 뜨면서 같이 다시 주목받고 있는 듯한 느낌도....

 

 https://blog.outsider.ne.kr/187


 

How to Create Sample WSDL in Eclipse and Generate Client ( 그림 설명 )

 

 

Have you ever tried creating Simple Java Web Service Definition Language in Eclipse? Well, here are few simple steps to create WSDL in Eclipse environment and Generate/Test Client.

http://crunchify.com/create-sample-wsdl-in-eclipse-and-generate-client/



Create a Java web service client via wsimport tool.


Alternative, you can use “wsimport” tool to parse the published wsdl file,
and generate necessary client files (stub) to access the published web service.

Where is wsimport?
This wsimport tool is bundle with the JDK, you can find it at “JDK_PATH/bin” folder.

Issue “wsimport” command.
> wsimport -keep http://localhost:9999/ws/hello?wsdl





WSImport over SSL with take (dev) certificate



Finally I got a solution, using wrapper class.

I think it makes sense to share the solution. Hope it will save some someone's time for better purposes.


http://stackoverflow.com/questions/29922479/wsimport-over-ssl-with-fake-dev-certificate



자바 기본 trust store에 서버 사설 인증서(공인 CA로부터 발급받지 않은)를 등록


javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException:
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target


Are you getting this error? This simply means that the web server or the URL you are
connecting to does not have a valid certificate from an authorized CA. But however,
being a programmer you would want to find out the alternative
way to solve this issue.


Default trusts의 암호는 "changeit"


> 보기(등록된 리스트)


c:\...\jre1.8.0_73>keytool -list -keystore .\lib\security\cacerts



> 등록


c:\...\jre1.8.0_73>keytool -keystore .\lib\security\cacerts -import -alias [등록을 원하는 이름, 주로 서비스 도메인] -file d:\server.cer


* server.cer은 브라우저를 통해서 접속후에  다운로드 가능


http://www.java-samples.com/showtutorial.php?tutorialid=210





블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,