cancel
Showing results for 
Search instead for 
Did you mean: 

web service를 cmd명령으로 실행하기

최우석
Level 3
제가 만든 메인프로세스를 web service로 노출시킨 후 cmd에서 원격으로 호출하고 싶습니다
블루프리즘 -> Processes -> Exposure  -> Expose a Process로 제가 만든 프로세스를 노출시킨상태이며
http://localhost:8181/ws/ 에 접속하여 해당프로세스를 확인할 수 있었습니다.
(메인프로세스는 엣지 프로세스 종료하고 끝나는 간단한 프로세스입니다)

문제는 cmd에서 명령을 실행할 때 나타나는데 실행하면

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 671
Cache-Control: no-cache

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><soap:faultstring>Couldn't process soap inputs - System.NullReferenceException: 개체 참조가 개체의 인스턴스로 설정되지 않았습니다.
위치: BluePrism.AutomateProcessCore.ProcessWSDL.ProcessSOAPInputs(String sInputs, BluePrismProcess proc, String&amp; sMethod, String&amp; sSession, String&amp; sErr)</soap:faultstring></soap:Fault></soap:Body></soap:Envelope>

이렇게 뜨고 있습니다.

제가 사용한 cmd명령은 
curl -X POST -H "Content-Type: text/xml; charset=utf-8" -d "<?xml version='1.0' encoding='utf-8'?><soap:Envelope xmlns:tm='http://microsoft.com/wsdl/mime/textMatching/' xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:mime='http://schemas.xmlsoap.org/wsdl/mime/' xmlns:tns='urn:blueprism:webservice:tpatest' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:s='http://www.w3.org/2001/XMLSchema' xmlns:soap12='http://schemas.xmlsoap.org/wsdl/soap12/' xmlns:http='http://schemas.xmlsoap.org/wsdl/http/' name='TPATestService' targetNamespace='urn:blueprism:webservice:tpatest' xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'><soap:Body></soap:Body></soap:Envelope>" -i http://localhost:8181/ws/TPATest -u 블루프리즘ID:PW 
입니다
-------------------------------------------------------------------------------------------------------

해결방법을 찾았습니다....
삭제 버튼을 찾을 수 없네요.
4 REPLIES 4

BohyonHwang
Level 9
열심히 노력하시는 모습이 멋지십니다.

BohyonHwang
Level 9
저도 비슷한 상황을 만들었습니다.
같은 오류를 경험했습니다.
다음과 같이 해 보니 문제가 해결되었습니다.

Microsoft Windows [Version 10.0.22621.1105]
(c) Microsoft Corporation. All rights reserved.

C:\>curl -X POST -H "Content-Type: text/xml; charset=utf-8" -d "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:urn='urn:blueprism:webservice:processlauncher'><soapenv:Header/><soapenv:Body><urn:LaunchaProcess soapenv:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'><bpInstance xsi:type='xsd:string'>auto</bpInstance><ProcessName xsi:type='xsd:string'>PI</ProcessName></urn:LaunchaProcess></soapenv:Body></soapenv:Envelope>" -i http://localhost:8181/ws/ProcessLauncher -u admin:admin
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 464
Cache-Control: no-cache

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><LaunchaProcess xmlns="urn:blueprism:webservice:processlauncher"><Result xsi:type="xs:string" xmlns="">Result of PI is 3.14159265358979</Result></LaunchaProcess></soap:Body></soap:Envelope>
C:\>

비즈니스 객체를 웹서비스로 노출시켜서 그런지  <bpInstance></bpInstance> 파라미터가 발견되었습니다.
<bpInstance>auto</bpInstance>로 설정하고 사용하면 블루프리즘이 세션 데이터를 자동으로 처리한다고 합니다.

참고하십시오.

최우석
Level 3
답변해주셔서 감사합니다.

이 명령을 수행하는 동안 또 다른 문제를 발견하였습니다.
파라미터 값으로 값을 넘겨줄 때 오류가 발생하였는데
영어와 숫자 값은 잘 넘겨주지만 한글값을 넘겨주면

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><soap:faultstring>Couldn't process soap inputs - System.Xml.XmlException: Name을(를) 구문 분석하는 동안 예기치 않은 파일의 끝이 나타났습니다. 줄 1, 위치 406
위치: System.Xml.XmlTextReaderImpl.Throw(Exception e)
위치: System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
위치: System.Xml.XmlTextReaderImpl.Throw(Int32 pos, String res, String arg)
위치: System.Xml.XmlTextReaderImpl.ParseQName(Boolean isQName, Int32 startOffset, Int32&amp; colonPos)
위치: System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
위치: System.Xml.XmlTextReaderImpl.ParseEndElement()
위치: System.Xml.XmlTextReaderImpl.ParseElementContent()
위치: System.Xml.XmlTextReaderImpl.Read()
위치: System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
위치: System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
위치: System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
위치: System.Xml.XmlDocument.Load(XmlReader reader)
위치: System.Xml.XmlDocument.LoadXml(String xml)
위치: BluePrism.Core.Xml.ReadableXmlDocument..ctor(String xml)
위치: BluePrism.AutomateProcessCore.ProcessWSDL.ProcessSOAPInputs(String sInputs, BluePrismProcess proc, String&amp; sMethod, String&amp; sSession, String&amp; sErr)</soap:faultstring></soap:Fault></soap:Body></soap:Envelope>

이런 오류가 발생하였습니다
해결방법이 있을까요?

BohyonHwang
Level 9
명령문으로 curl을 테스트할 때는 한글 지원이 되지 않습니다.
이는 명령줄에 입력된 한글이 utf-8이 아니라 cp949이기 때문으로 보입니다.
curl 명령을 notepad로 열고 save as 인코딩 UTF-8로 저장(.bat 파일 확장자로)한 다음, 저장한 .bat 파일을 실행해 보십시오.
다른 방법으로는 명령줄에서 사용한 인코딩을 utf-8에서 euc-kr로 바꿔서 사용해 보는 방법이 있습니다.
이 경우 일부 한글만 문제가 발생할 수 있는데 이 때는 utf-8을 cp949로 바꿔서 사용해도 될 수 있습니다.
참고: 최근 Unix나 Linux라면 LANG=UTF-8 설정으로 명령줄에서 바로 한글을 사용할 수 있기도 합니다.